| Thread overview | |||||
|---|---|---|---|---|---|
|
March 29, 2008 version'ing issue | ||||
|---|---|---|---|---|
| ||||
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?
| ||||
March 29, 2008 Re: version'ing issue | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Koroskin Denis | 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 | |||
March 30, 2008 Re: version'ing issue | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Koroskin Denis | 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.
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply