Close

Units

A project log for BCFJ

Because I want to create a good-for-all language borrowing qualities from Bash, BASIC, C, Forth and JavaScript

yann-guidon-ygdesYann Guidon / YGDES 03/31/2018 at 04:520 Comments

Have you ever used Turbo Pascal ? or Ada ? Or VHDL ?

In TP, you can make a program, but also share code with what's called "units". They are named "libraries" in VHDL.

In BCFJ, everything is a "unit".

A "unit" is code, linked to other units by a collection of entry points.

When "init" is void/empty/absent, the unit is comparable to a shared library/dll.

The "Init" can also be equivalent to the "main" in C/POSIX. Other entry points are not absolutely required but they can provide asynchronous signal handling for the unit.

Unlike POSIX shared libraries, a direct call is not possible, units have separate and protected address spaces. The calling process must perform an Inter Process Call and send the information through the registers and shared memory spaces.

Some units can be IPCalled and access the calling process' address space BUT can't use any other space at the same time : they provide shared routines, that's all. Data leaks shouldn't be possible unless explicitly requested...

Remember : units do not have to trust each other. The caller and the callee should not assume benevolence, security and/or safety. A unit could be replaced by a different version between IPCs, either for maintainance or because something went wrong... So don't let any unit's code access your private data.

This is where "capabilities" and process properties become essential. In order to let other units call you or accept your call, you need reliable information about their rights. For example you can't let anybody call your "init" entry point (only a given process can do this and its process ID might change, but not its access rights)

Discussions