The non allocating D subset
SomeDude
lovelydear at mailmetrash.com
Fri May 31 22:45:30 PDT 2013
In the "Rust based provocation thread", I think Adam Ruppe's work
went largely overlooked. He basically created a minimal D that
runs on bare metal, proving thus that D can be used fruitfully on
small embedded devices in place of C.
On Monday, 27 May 2013 at 15:45:04 UTC, Adam D. Ruppe wrote:
> On Monday, 27 May 2013 at 14:36:59 UTC, Dicebot wrote:
>> But issue is not creating minimal run-time, it is creating
>> minimal one that still has most part of language usable.
>
> eh the question is what is "most"? Even my little 200 line
> thing has: functions, templates, scope closures, structs
> including operator overloading, static arrays, slices,
> pointers, __traits+ctfe, scope guards, switches, and more.
>
> I just now added basic classes and that wasn't too hard
> (copy/pasted some code from the real druntime for the typeinfo
> and so on).
>
> But it doesn't do AAs, throwing exceptions, dynamic arrays and
> other nice features. Looking at druntime's src, exceptions look
> hard, and while dynamic arrays, heap closures, and others can
> easily 'work', they will leak memory, so I don't think they
> will ever be really good without gc. Exceptions are doable
> though from what I can tell.
>
>
> Anyway I think this is enough to do some real programs and feel
> kinda nice. Surely no worse than C at least.
This is already a great proof of concept in my opinion.
But more than that, I believe that this minimal D is the
sublanguage that could prove useful to game programmers in place
of C++.
Basically it is a non allocating D subset. It retains most of the
niceties of D without ever resorting to the GC, so it's a
definite improvement over C++. There is absolutely no reason
performance would suffer from programming in this D sublanguage.
The only real hassle being one still has to do manual memory
management, but users of such a subset are used to that and
prefer to do it themselves than using a GC anyways.
Following this idea, I believe a fairly large chunk of Phobos
could be ported to compile with this minimal D sublanguage, and
that one could use the allocating D and its added sugar on top of
it. So in the end, the user could decide between working with the
non allocating language (mostly embedded programmers and game
makers), or benefit from the GC and all the associated niceties
(the rest of us).
This would make D the truely universal language it was intended
to be.
More information about the Digitalmars-d
mailing list