Minor extension to cast syntax

Steven Schveighoffer schveiguy at yahoo.com
Wed Oct 31 13:17:39 PDT 2007


"Mike" wrote
> Hi!
>
> There's some minor thing about the cast syntax that would be very nice to 
> have. I haven't seen this mentioned here anytime, so ...
>
> cast ( Type ) UnaryExpression
>
> Now, the thing is that casts usually look like ...
>
> cast(type)(some_expression);
>
> ... at least in my source code. Most casts need the second pair of 
> parentheses. So I suggest an additional casting syntax:
>
> cast ( Type, UnaryExpression )

Mike,

This sounds like a matter of personal preference.  Since you can already 
achieve the same thing via the current syntax (with very little change), it 
would seem that the cost/reward ratio is awfully high.

-Steve






More information about the Digitalmars-d mailing list