Re: New keywords: ifdef, elsifdef, end ifdef

new topic     » goto parent     » topic index » view thread      » older message » newer message

Jeremy Cowgar wrote:
 
> yuku wrote:
> > 2. Use static if (idea from D)
> > 
> > }}}
<eucode>
> > static if VERSION > 400 then
> >     puts(1, "you are in the future!")
> > elsif VERSION < 400 then
> >     puts(1, "Please upgrade")
> > else 
> >     puts(1, "hohoho");
> > end if
> > </eucode>
{{{

> > 
> > Adv: One keyword instead of 2. Only need to write "static" once instead of 2
> > times
> > "defined" like above. Can use >, <, = instead of just boolean testing.
> > Dis: same as above

I love the D language but this use of 'static' is one of the most blatant warts
in its syntax. There seems to be an absolute terror by the D developers to use
new keywords so they use existing ones in new and confusing ways.

I have no problem with the proposed keyword 'ifdef' to signal the start of
parser-time condition testing. The 'else' and 'elsif' keywords can be comfortably
reused in this context as they semantically mean the same whether processed at
parser-time or at execute-time, the only difference is *when* it gets processed.


-- 
Derek Parnell
Melbourne, Australia
Skype name: derek.j.parnell

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu