Ary Borenszweig wrote:
Andrei Alexandrescu wrote:
Ary Borenszweig wrote:
のしいか (noshiika) escribió:
Thank you for the great work, Walter and all the other contributors.
But I am a bit disappointed with the CaseRangeStatement syntax.
Why is it
case 0: .. case 9:
instead of
case 0 .. 9:
With the latter notation, ranges can be easily used together with
commas, for example:
case 0, 2 .. 4, 6 .. 9:
And CaseRangeStatement, being inconsistent with other syntaxes using
the .. operator, i.e. slicing and ForeachRangeStatement, includes
the endpoint.
Shouldn't D make use of another operator to express ranges that
include the endpoints as Ruby or Perl6 does?
I agree.
I think this syntax is yet another one of those things people looking
at D will say "ugly" and turn their heads away.
And what did those people use when they wanted to express a range of
case labels? In other words, where did those people turn their heads
towards?
They probably used an if.
So they used an inferior means to start with.
But I think it's not about that. If D didn't have the possibility to
define case range statements, it would be better. Now there's a
possibility to do that, but with an ugly syntax (you'll find out when
this newsgroup will receive about one or two complaints about this each
month, not to mention there were already a lot of complaints).
This is speculation. And the complaints usually were accompanied with
inferior suggestions for "improving" things. Everyone wanted to add some
incomprehensible, inconsistent, or confusing syntax to do ranged cases,
as long as it wasn't the one I'd chosen.
You can
find other "ugly" things by looking at repetitive mails to this newsgroup.
I and others don't find the added syntax ugly in the least.
Also, there's a limitation of just 256 cases. What's that? Where that
limitation come from? That looks week.
That's just an implementation limitation that future versions will
eliminate.
Andrei