druntime redesign

Jonathan Marler johnnymarler at gmail.com
Tue Feb 25 22:56:12 UTC 2020


On Tuesday, 25 February 2020 at 22:39:54 UTC, Petar Kirov 
[ZombineDev] wrote:
> On Tuesday, 25 February 2020 at 16:42:04 UTC, Jonathan Marler 
> wrote:
>> On Tuesday, 25 February 2020 at 00:05:05 UTC, Denis Feklushkin 
>> wrote:
>>> Hi!
>>>
>>> This post is inspired by: 
>>> https://forum.dlang.org/thread/scklbdrgjiypknuephfj@forum.dlang.org
>>>
>>> [...]
>>
>> Somewhat related that might be of interest to you.  I wrote my 
>> own standard library that doesn't depend on libc, doesn't use 
>> druntime and is compatible with betterC.  
>> https://github.com/dragon-lang/mar
>
> This project is very interesting to me I believe it may be 
> extremely valuable to D as a whole! I have seen it a few months 
> ago, but back then I didn't have much time to check it out.
>
> What is the current status?
> Is it self-hosting? E.g. can you build dmd only with it?
> What are your goals (in addition to minimal external 
> dependencies)?
> How much of Phobos and druntime do you want reimplement or 
> offer alternative features to?
>
> Threading, ranges, containers and algorithms, IO, std.math, 
> etc.?

I wanted to be able to use D without relying on libc.  One use 
case I had for this was to write my own rootfs purely in D 
(https://github.com/marler8997/maros).  I was very glad I did 
this as it was instrumental in learning how most linux 
distributions work.

I want my standard library to work with or without GC, druntime, 
libc, phobos, and betterC.  I want the API to be as similar as 
possible whether or not I'm using these features.  I want to be 
able to enable/disable these like features without rewriting my 
code.  In order to do this, the standard library needs to work 
with or without them.

Also note that the "mar" library can be used alongside 
druntime/phobos as well.  It's in its own namespace so there's no 
issues in using them together.  I was able to gradually port code 
to use "mar" instead of druntime/phobos piece by piece by 
referencing both.

Another big feature is that "mar" tracks null-terminated strings 
in the type system.  Pretty much all OS APIs use null-terminated 
(aka sentinel) strings, and it seems like a good idea to enforce 
them at compile-time rather than runtime.

Anyway, there was alot of reasons I made it.  Even if all it 
becomes is an educational experience for me then I'm still glad I 
did it, and if other poeple can find more uses for it then even 
better.



More information about the Digitalmars-d mailing list