Porting D2 code to D1

Jason House jason.james.house at gmail.com
Thu Jul 17 06:27:00 PDT 2008


Jarrett Billingsley Wrote:

> "Jason House" <jason.james.house at gmail.com> wrote in message 
> news:g5lib0$23ju$1 at digitalmars.com...
> 
> > I can't imagine any library maintainer being willing to do that just for 
> > portability between D versions.  It'd be nice if D2 code could have 
> > something like version(d1){} and version(d2){} for this purpose.  That'd 
> > then allow the d2 compiler to ignore version(d1){} and allow the converter 
> > to strip out version(d2){}
> 
> I've always been dubious about using the version construct for various 
> language versions.  It's great for program options, but since the stuff in 
> the version block has to be syntactically legal, it makes it worthless for 
> supporting multiple versions of D.


Who says what's in version(d1) has to be legal D1 code? ;)  I'd vote that the code would still look like D2 code and would be converted in the same way as all other code.


> It's almost like another construct is needed.  I like what you're thinking 
> but I don't know if using the version construct is the right way to do it. 


If that construct is restricted to the converter (ie. ignore eliminate version(d2){}), I think nobody will complain.



More information about the Digitalmars-d mailing list