The original motivation: Library-based Version

Nick Sabalausky a at a.a
Mon Oct 18 17:46:30 PDT 2010


"bearophile" <bearophileHUGS at lycos.com> wrote in message 
news:i9inpb$15n5$1 at digitalmars.com...
> Nick Sabalausky:
>
>> The goal of this challenge is to define a global-level manifest constant
>> enum that holds a value that has been incremented from multiple modules:
>
> And I hope people will try to solve it!
> So if someone solves it, we can later patch that bug ;-)
>

FWIW, The original motivation for this was that I was reading the recent 
"Improving version(...)" thread and thought "isVersion" was a notable 
improvement, but still didn't solve the problem that version identifiers 
don't have to be pre-defined and are therefore subject to bugs from typos. I 
wondered if an acceptable library-based solution could be done and started 
tinkering with it, but quickly realized it would most likely need mutable 
global compile-time state which D doesn't have a direct mechanism for. The 
only way to trigger CTFE seems to be by creating a value that's immutable 
even at compile-time (ex: enum x = ctfeFunc()). And trying to do it with 
template or mixin trickery leads to seemingly insurmountable scope-related 
problems.




More information about the Digitalmars-d mailing list