July 06, 2009
Derek Parnell wrote:
> I'm struggling to see why the compiler cannot just disallow any
> signed<->unsigned implicit conversion? Is it a matter of backward
> compatibility again?

What's the signed-ness of 5?

When you index a pointer, is the index signed or unsigned?
July 06, 2009
Derek Parnell wrote:
> I'm struggling to see why the compiler cannot just disallow any
> signed<->unsigned implicit conversion? Is it a matter of backward
> compatibility again?

What's the signed-ness of 5?

When you index a pointer, is the index signed or unsigned?
July 06, 2009
Thanks for the new release!  Are case ranges limited to 256 cases?

% cat -n foo.d
     1  import std.conv;
     2  import std.stdio;
     3
     4  void main(string[] args)
     5  {
     6      int i = to!int(args[0]);
     7
     8      switch (i) {
     9      case int.min: .. case -1:   // line 9
    10          writefln("negative");
    11          break;
    12      case 0:
    13          writefln("zero");
    14          break;
    15      default:
    16          writefln("positive");
    17          break;
    18      }
    19  }
% dmd foo.d
foo.d(9): Error: more than 256 cases in case range
%
July 06, 2009
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?
July 06, 2009
MIURA Masahiro wrote:
> Thanks for the new release!  Are case ranges limited to 256 cases?

Yes.
July 06, 2009
のしいか (noshiika) wrote:
> 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 think this was hashed out ad nauseum in the n.g.

D does introduce another operator, the

   :..case

operator <g>.
July 06, 2009
Walter Bright wrote:
> のしいか (noshiika) wrote:
>> 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:

Or
    case [0..10]:
?

Compatible to how list slicing works.

Ah yes, bikeshed issue, but my solution is more beautiful.

Also, Walter, did you ever think about doing something about the fall-through-by-default issue? Of course in a way that preserves C compatibility.
July 06, 2009
grauzone wrote:
> Also, Walter, did you ever think about doing something about the fall-through-by-default issue? Of course in a way that preserves C compatibility.

There have always been much more pressing issues.
July 06, 2009
grauzone wrote:
> Walter Bright wrote:
>> のしいか (noshiika) wrote:
>>> 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:
> 
> Or
>     case [0..10]:
> ?
> 
> Compatible to how list slicing works.
> 
> Ah yes, bikeshed issue, but my solution is more beautiful.
> 
> Also, Walter, did you ever think about doing something about the fall-through-by-default issue? Of course in a way that preserves C compatibility.

Do u mean this http://digitalmars.com/d/2.0/statement.html#FinalSwitchStatement
July 06, 2009
Thanks everybody!