Porting D2 code to D1

Ryan Bloomfield _sir_maniacREMOVE_ME at yahoo.com
Thu Jul 17 23:43:31 PDT 2008


Bill Baxter Wrote:

> Ryan Bloomfield wrote:
> > Jarrett Billingsley Wrote:
> >> To be honest, I kind of wish this were the case with version statements all 
> >> the time. 
> >>
> >>
> > 
> >     I disagree. I think it's good for all version blocks to compile under normal circumstances.  If it didn't do that, uncompilable code could creep in.   It would be especially bad if it involves machine-specific code.  Coding between different versions of D is clearly going to be used less then the other intended uses of 'version'.  
> 
> But it doesn't really solve the problem.  So you have syntactically 
> correct code.  Yippee.  You still can't say whether it's semantically 
> valid until you actually compile it.  So it provides protection from 
> code rot some of the time.  But if you're worried about code rot, 
> syntactic validity is not enough.  There's no substitute for actually 
> compiling and testing the code you want to have work.

I thought about the limitations of syntactic validity when I was writing it.   I suppose I should have included that thought.  I think the following is still an issue:

Nothing within version blocks can be guaranteed to be syntactically correct for any form of syntax analysis, without semantically determining the actual values set with 'version=...'. 

This also appears breaks the rule: "a source file can be syntactically analyzed without needing any semantic information"  from the following interview:

http://www.bitwisemag.com/copy/programming/d/interview/d_programming_language.html

I may just be rambling on here, does this make sense?





More information about the Digitalmars-d mailing list