equality operators on types
Timon Gehr
timon.gehr at gmx.ch
Fri Jun 15 05:11:22 PDT 2012
Why not allow equality operators to operate on types?
is(==) expressions tend to create bracket noise and treat the two
arguments non-uniformly.
This would suggest a little parser update, so that eg. 'int', '(int*)'
and 'int[]' are accepted as valid expressions. (this also potentially
improves compiler error messages.)
void foo(T)(T arg){
static if(T==int){
...
}else{
...
}
static if(T!=double) ...
}
As far as I can see, this would be fully backwards-compatible.
(modulo compile-time introspection.)
More information about the Digitalmars-d
mailing list