equality operators on types
Timon Gehr
timon.gehr at gmx.ch
Sat Jun 16 04:37:26 PDT 2012
On 06/16/2012 02:48 AM, Walter Bright wrote:
> On 6/15/2012 5:11 AM, Timon Gehr wrote:
>> Why not allow equality operators to operate on types?
>
> Generally because of parsing problems.
What kind of problems? All types fit into the expression grammar well
enough. (pointer types should require parentheses in order to simplify
parsing)
The parser can already parse this:
static if(int.min == (int*).min) { }
It should be trivial to adapt it so that it can parse this:
static if(int == (int*)) { }
(in essence, stop requiring the scope resolution after everything that
unambiguously looks like a type. The current behaviour is inconsistent
anyway.)
More information about the Digitalmars-d
mailing list