Am 10.04.2013 18:05, schrieb ixid:
It is possible, but it heavily crippeles the language and requires
modifications to druntime.
See: http://3d.benjamin-thaut.de/?p=20
Also see my GC free version of druntime:
https://github.com/Ingrater/druntime
My GC free version of phobos (heavily crippeled):
https://github.com/Ingrater/phobos
And my little GC free "standard library":
https://github.com/Ingrater/thBase
Its quite fun doing it when you want to learn new things, but I would
not recommend doing so in a real wordl project.
Given what you have learned about GC-free D how practical would it be to
modify D's core to work without garbage collection and then build
libraries on top of this which make their GC use explicit? It seems to
me that this is a level of modularity that should have been built in
from the start.
For Druntime this is possible without much issues. For phobos it gets
more compilcated especially for functions which have to allocate, like
string processing functions and other things.
In my experience the API of an Library looks different if is uses a GC
versus not using a GC. The advantage of a GC is that you can make the
API more slim, easier to understand and "safe" because you know that you
can rely on the GC.
Some parts of phobos already are written in a way that does not require
a GC. E.g. std.random, std.traits, std.typetuple and others are useable
right away.
The problem I see with such an approach is that everyone who is
providing a library would basically have to maintain two version of the
library. One without a GC and one with GC.
But with some compiler support it would be perfectly doable, it would
just be more work.
Kind Regards
Benjamin Thaut
--
Kind Regards
Benjamin Thaut