"BareBones" VersionCondition identifier for druntime

Kevin Lamonte via Digitalmars-d digitalmars-d at puremagic.com
Sun Oct 19 15:46:34 PDT 2014


On Sunday, 19 October 2014 at 05:35:39 UTC, Walter Bright wrote:
>
> It's a good idea, but having a bunch of versions quickly 
> devolves to an unmaintainable mess, in my experience. For one 
> issue, when one adds a new piece of code, which versions apply 
> in what ways? Once the number of versions exceeds a certain 
> level, I've never seen it done right.
>
> A better solution is to have modules that "plug in" or not. The 
> gc is designed this way.
>
> Also, dmd's source code is also (largely) done this way. Stuff 
> that would normally be #ifdef'd is instead abstracted away to 
> an interface. My experience with such techniques is they work 
> well, are relatively problem free, and are much easier on the 
> eyes.

I'm starting to see how that works now.  For example, even though 
I am implementing gc_malloc and friends as separate functions for 
now (which forces me to understand what they do), it's looking 
like I might be able to get to the same point with a proxy in the 
garbage collector (that never collects).

But how would this kind of modular design enable avoiding 
importing core.stdc.* at link time?  Maybe the more general form 
of the question: can one avoid an import at compile and link time 
without "static if()" or "version()" ?


More information about the Digitalmars-d mailing list