version'ing issue
Derek Parnell
derek at psych.ward
Sat Mar 29 15:56:47 PDT 2008
On Sun, 30 Mar 2008 00:14:15 +0300, 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?
The workaround is just plain butt ugly and should be a sameful thing to
use.
class SomeClass
{
version( D_Version2 )
{
mixin(`
invariant void someMethod()
{
}
`);
} else {
void someMethod()
{
}
}
}
void main(){}
--
Derek Parnell
Melbourne, Australia
skype: derek.j.parnell
More information about the Digitalmars-d
mailing list