On 08/01/2014 04:31 AM, Andrei Alexandrescu wrote:
On 7/31/14, 7:19 PM, Martin Nowak wrote:
You cannot use version identifiers to selectively disable functionality
or people would have to compile their own phobos library for every set
of version combinations.

Wait, doesn't code work with the version chosen by the user? -- Andrei


Well phobos as a library is precompiled, so the versions used to compile phobos will be relevant, not the ones in client code.

For templated functions version identifier will "leak" from client code into the library, because technically they are instantiated by the client code.

Also the version identifiers of client code determine which declarations you see.

Relying on this would be a constant source of bugs.

I did proof-of-concept yesterday using type tags and template constraints to statically disable certain log levels. It also has some drawbacks because LogLevel is no longer a plain enum, but it's more appropriate than version identifiers.
http://forum.dlang.org/post/[email protected]

Reply via email to