"bearophile" <[email protected]> wrote in message news:[email protected]... > 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). >
vote++ Anything that reduces parenthesis-hell without inviting ambiguities in either the compiler or the "human-eye parser" is good by me :) Besides, I love member access syntax in general. In addition to (safely) reducing parenthesis, it also sidesteps the oddity that nested function calls are written/read *backwards* from the order of execution (ie, "A(B(C()))" means "call C, then B, then A"). I've even been toying with the idea of a language design that places primary emphasis on member-call syntax and consistent left-to-right ordering.
