Plan for Exceptions and @nogc?

philippecp via Digitalmars-d digitalmars-d at puremagic.com
Mon Feb 16 21:52:21 PST 2015


I was wondering the same myself. I think there would be a lot of 
negative side effects to using alternate memory model other than 
GC (non-gc could introduce leaks, on stack has potential to be 
overwritten). For that reason, I think the only choices that make 
sense are that either @nogc functions are also nothrow, or that 
phobos has a set of preallocated immutable exceptions that can 
can thrown.

I personally think that @nogc should be relaxed to exclude 
allocating exceptions since there would be no gc allocation other 
than for exceptional situations. I suspect that having code that 
relies on exception for main case logic is far worse for 
performance than any gc overhead anyway and is a pattern everyone 
knows to avoid.



More information about the Digitalmars-d mailing list