Request: (T) == T
Robert Fraser
fraserofthenight at gmail.com
Mon Dec 10 12:40:05 PST 2007
Janice Caron wrote:
> Wherever T is a type expression, please could (T) also be a type
> expression, evaluating to T. That is, please could (T) be made to
> compile, as if the brackets weren't there. For example, let
>
> (int) x;
>
> be the same thing as
>
> int x;
>
> declaring x to be an int, and let
>
> (int)[] p;
>
> be the same thing as
>
> int[] p;
>
> declaring p to be an array of ints. For that matter ((((T)))) should
> also evaluate to T, and const(const(T)) should evaluate to const(T),
> and so on.
>
> This would be useful for generic programming, mixin strings, etc.
*Channeling Walter*
This may be unexpected behavior for programmers with backgrounds in
other C-style languages, since (T) is a cast in those languages.
More information about the Digitalmars-d
mailing list