Alternative typeof syntax

bearophile bearophileHUGS at
Mon May 17 12:44:38 PDT 2010

What do you think about the the syntax  x.typeof  instead of  typeof(x)  ?
There are situations where you will need to parenthesize anyway, for example:

import std.stdio;
void main() {
    int x = 1;
    float y = 1.5;
    writeln(typeid(typeof(x + y)));

You have to write:
(x + y).typeof

But in many situations you don't need the (). 
And it gets more similar/uniform to the x.sizeof syntax too (that is sizeof(x) in C).


More information about the Digitalmars-d mailing list