design
2023-11-20 execution environment
2023-11-20 the execution environment of shelter is one big JIT compiler. code is portable between CPU architectures and exchanged via a compact intermediate representation (IR), which is then compiled to machine code when installed into the system
2023-11-20 compilers which emit this IR must not perform aggressive inlining. this is important for the OS’s function database to work correctly and be able to deduplicate functions aggresively. instead, inlining is done by the JIT upon compilation (or maybe even based on profiling)
2023-11-20
executable code
2023-11-20 this is probably the most exciting part of shelter: how executable code is not stored within
.exe
and.dll
files, but rather in a database managed by the OS2023-11-20 function metadata includes reflection data - argument/return types, generics (so that monomorphization is performed on-demand by the JIT to save disk space), and annotations (so that the OS can know eg. which functions are valid program entry points)
2023-11-20 it can be used eg. to implement a shell, which executes named functions, such as
ls
here:@os.entrypoint fun ls( caps: (working_directory: shell.WorkingDirectory(:read)), args: (compact: shell.Flag(short: "l")), ): Result(()) :: os.stdio.Write + os.Filesystem = caps.working_directory.path | fs.walk fun (entry) = { if args.compact.is_set then { print("\{entry | fs.dirent.path? | path.filename}") } else { print("\{entry.kind}\t\{entry | fs.dirent.path? | path.filename}") } }
2023-11-20