www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Indicating incompatible modules

reply Joseph Rushton Wakeling via Digitalmars-d-learn writes:
Hello all,

Is there a straightforward way to indicate that two modules should not be used 
together in the same program?  Preferably one that does not require editing
both 
of the modules?

The application I have in mind is when one is making available an experimental 
module which is planned to replace one that already exists; it's useful for the 
experimental module to be able to say, "Hey, use me _or_ the standard module, 
but not both of us."

Any thoughts ... ?

Thanks & best wishes,

     -- Joe
May 31 2014
parent "Dicebot" <public dicebot.lv> writes:
On Saturday, 31 May 2014 at 16:34:00 UTC, Joseph Rushton Wakeling 
via Digitalmars-d-learn wrote:
 Hello all,

 Is there a straightforward way to indicate that two modules 
 should not be used together in the same program?  Preferably 
 one that does not require editing both of the modules?

 The application I have in mind is when one is making available 
 an experimental module which is planned to replace one that 
 already exists; it's useful for the experimental module to be 
 able to say, "Hey, use me _or_ the standard module, but not 
 both of us."

 Any thoughts ... ?

 Thanks & best wishes,

     -- Joe
Only at run-time (because of separate compilation) - you can iterate ModuleInfo and assert that only one of modules is available.
May 31 2014