On Mon, 15 Jun 2015 12:48:31 +0000, Ola Fosheim Grøstad wrote:

> On Monday, 15 June 2015 at 08:25:08 UTC, Mike Parker wrote:
>> Not using version statements. They only apply to the module in which
>> they are declared. To use it in multiple modules, you need static if
>> and enums.
> 
> Ack… That was new to me. What is the reasoning behind this?

module processing order is not defined. so module A can try to define 
some version, and module B then try to check it, but compiler chooses to 
process module B first, and... KABOOM! compiler is free to process 
modules in parallel too, which makes things even more complicated.

besides, let's imagine this code:

  version(abc) { ... } // abc must not be defined

  import mymodule_that_defines_abc;

  version(abc) { ... } // abc must be defined

but! the specs says that module import order (and even position) doesn't 
matter. so if you allow versions to go over module boundaries, this 
innocent-looking code must have `abc` defined for both blocks. definetely 
not what the author of the code wants.

this also adds some more dependency issues too.

all in all, it creates more problems than it is trying to solve.

Attachment: signature.asc
Description: PGP signature

Reply via email to