D Language 2.0

bearophile bearophileHUGS at lycos.com
Tue Jan 19 22:51:51 PST 2010


Andrei Alexandrescu:
> I'd love -nogc. Then we can think of designing parts of Phobos to work 
> under that regime.

But you must do this with lot of care: programmers coming from C++ will be tempted to write code that uses those GC-free parts of Phobos a lot, the end result will be a lot of D code in the wild that's like C++ or worse. So when you want to use one of those modules or libraries, you may need to dance their no-GC dance. This can invalidate the good idea of designing a GC-based language.

A better strategy is first of all to improve a lot the D GC, if necessary to introduce in the language other details to help the design of a more efficient GC (like giving ways to tell apart pinned objects from normal ones, make the unpinned ones the default ones, and modify the type system so mixing pinned-memory and unpinned-memory pointers is generally safe, etc). Only when further improvements to the GC become too much hard, you can start to write no-GC parts of Phobos, few years from now.

I have seen many cases where Java code run with HotSpot is faster than very similar D1 code compiled with LDC. Avoiding the GC is a easy shortcut, but I think it's not a good long-term strategy for D.

Bye,
bearophile



More information about the Digitalmars-d mailing list