D1 -> D2

%u e at ee.com
Fri Nov 19 16:38:19 PST 2010


== Quote from Bernard Helyer (b.helyer at gmail.com)'s article
> On Thu, 18 Nov 2010 19:58:42 +0000, %u wrote:
> > == Quote from Denis Koroskin (2korden at gmail.com)'s article
> >> On Thu, 18 Nov 2010 22:19:12 +0300, Walter Bright
> >> <newshound2 at digitalmars.com> wrote:
> >> > Steven Schveighoffer wrote:
> >> >> My recommendation -- when you are ready, switch wholly to D2.  Don't
> >> >> bother with compatibility, it's just not possible.
> >> >
> >> >  From what you wrote, it appears that most of the difficulties were
> >> >  in
> >> > dealing with strings.
> >> No, it's not. From my experience, a bigger issue is that version (D2) {
> >>     /* some D2 only code involving const etc */
> >> }
> >> simply won't compile in D1, because even if it's D2-only the code needs
> >> to be correct D1 code as well.
> >
> > Wow, that sucks!!
> > Can't this simply be mended with special D_DMD1 and D_DMD2 (D_DMD3 :)
> > version identifiers?
> > If the compiler version isn't the same then it won't look at the code.
> No. The contents of a version block is still parsed. If the D2 code
> doesn't _parse_ as valid D1, then the D1 compiler will reject it, even if
> the version block will not be processed further than that.

Well, actually I said the compiler wouldn't look at it, so it wouldn't get parsed
as well.
What you should have said is that is very difficult to not parse a piece of code
and still know its boundaries ;)
So how can the compiler be sure a version block ends without actually parsing the
text as code.
A single line version would do :)


More information about the Digitalmars-d mailing list