Leandro Lucarella Wrote: > Andrei Alexandrescu, el 19 de enero a las 23:17 me escribiste: > > bearophile wrote: > > >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 > > > > Walter and I talked for hours about a no-gc model for D, and the > > conclusion was that with only a little compiler support, things can > > be arranged such that swapping different object.d implementations, > > the entire D allocation model can be swapped between traditional GC > > and reference counting. > > Again? RC is *not* -nogc, is -anothergc. And reference counting won't do > the trick unless you add a backing GC to free cycles. What I mean about > -nogc is *no* GC, is "please, mr compiler, give me an error when a GC > facility is used".
Yeah, this is what I thought -nogc meant as well. Not that I don't think that reference counting wouldn't be useful, but reference counting has its own problems. I would be interested in a -refcounting option or something like that though. It would be useful to compare the performance of the two systems. -Craig