syntax idea: simplifed ifs
Bruno Medeiros
brunodomedeirosATgmail at SPAM.com
Thu Apr 13 12:45:06 PDT 2006
dennis luehring wrote:
> for example how often do we use constructs like
>
> if( x == 10 && x == 20 && x == 30 )
>
> simplified:
> if( x == [10 && 20 && 30] )
>
> if( a >= h && b >= h && c >= h )
>
> simplified:
> if( [a && b && c] >= h )
>
> (just an idea)
>
> ciao dennis
Dear Gods, no! I'm against adding such a specific rule to the language,
thus increasing it's complexity, just for IMO a *very small* gain in
term of syntactic sugar (and change agility).
Like someone said already, if we had array literals we could probably
have a general solution, like:
[10, 20, 30].contains(x)
or:
x in [10, 20, 30]
But even if we can't find a better alternative such as this one, I'm
still against this specific idea.
--
Bruno Medeiros - CS/E student
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D
More information about the Digitalmars-d
mailing list