version'ing issue

Mike Parker aldacron71 at yahoo.com
Sat Mar 29 22:07:27 PDT 2008


Koroskin Denis wrote:
> This won't compile under D 1.x:
> 
> class SomeClass
> {
>     version( D_Version2 )
>     {
>         invariant void someMethod()
>         {
>         }
>     } else {
>         const void someMethod()
>         {
>         }
>     }
> }
> 
> int main()
> {
>     return 0;
> }
> 
> 
> Maybe 'version'ing should be less restrictive on syntax so that backward 
> compatibility could still be possible.
> Now I'm a little stuck with porting code from D2.012 to D1.028.
> 
> Or should we just choose one version and stick with it?

What I'd like to see is a special case for language versions, such as 
with debug:

debug {
blah blah
}

So we could do something like:

D_Version2 {
blah blah
}

These blocks would only be parsed if the compiler conforms to that 
version of the spec or later.



More information about the Digitalmars-d mailing list