3 ms·
I’ve had similar notions. For example, Rust used to have a garbage collector. A language set boundary would be a good way to add this back in without requiring
by jiggawatts 5y ago
I’ve had similar notions.
For example, Rust used to have a garbage collector. A language set boundary would be a good way to add this back in without requiring a runtime at the lower levels.
Rust already has “levels”, such as no-std or core.
Similarly C# has a scripting variant: https://visualstudiomagazine.com/articles/2021/06/14/csharp-scripting.aspx?m=1 https://visualstudiomagazine.com/articles/2021/06/14/csharp-...
And it also supports AoT compilation to a single EXE, but there were a lot of limitations. The latest attempt is a WIP: https://github.com/dotnet/runtime/issues/61231 https://github.com/dotnet/runtime/issues/61231
I would argue that libraries especially need highly restricted language subsets. E.g.: an image parser library should be “pure” in the sense of never being permitted to access system APIs. Image binary in, decoded bitmap out. Like a pure function, but at the module level.
- pjmlp 5y agoThere are various approaches to native compilation on .NET. NGEN which was there since day one, but its main purpose was fast startup and only allows for dynamic linking. Mono AOT one, used by Xamarin workloads for iOS and Android deployments. The Sing# and System C# dialects used by Singularity and Midori respectively. The MDIL used by Windows Phone 8 and 8.1, based on Singularity's Bartok compiler. .NET Native introduced in Windows 10 for UWP workloads, replacing the MDIL based one, originally known as Project N. The NativeAOT pointed by you, which started as a research project on how to bring .NET Native back into main .NET. Finally some alternative ones like Unity's IL2CPP or CosmOS.
- zozbot234 5y agoRust is getting support for local allocators/arenas as part of its core library. So it could become quite feasible to get support for tracing and garbage collection within a specific arena, with outside "GC roots" being managed by the borrow checker. You'd be fine as long as nothing in there tried to link back to your "GC roots". Similarly, "leaf" allocations could also live outside the GC arena provided that they did not try to link back into it. Either of these constraints seems like it could be checked during compile.