Cross module version specs

Paulo Pinto pjmlp at progtools.org
Thu Apr 26 23:32:12 PDT 2012


On Friday, 27 April 2012 at 05:51:36 UTC, Walter Bright wrote:
> On 4/26/2012 3:09 AM, James Miller wrote:
>> I'm trying to write a binding that has conditional sections 
>> where some features
>> have to be enabled. I am using version statements for this.
>>
>> I have a list of version specs in a module by themselves. When 
>> I try to compile
>> another module that imports this module, it acts as if the 
>> version was never
>> specified. I have tried wrapping the specs inside a version 
>> block, then setting
>> that from the command but that doesn't work. Setting the 
>> version manually works
>> as expected. I have also tried including the versions file on 
>> the command line.
>>
>> All I can think is that version specifiers aren't carried 
>> across modules, which
>> pretty much makes them completely useless unless you only use 
>> the built-in
>> versions.
>
> This is quite deliberate behavior.
>
> Aside from the rationale and other solutions given in this 
> thread, the one I prefer is to define features as functions, 
> and then implement those functions or not depending on the 
> configuration.


I would be with Walter on this.

This is the usual behavior in any other module based language 
with conditional compilation support. Developers picking up D 
would be confused, if the behavior would be different here.

--
Paulo



More information about the Digitalmars-d mailing list