[Issue 4272] x.typeof syntax
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Oct 7 01:20:44 PDT 2012
http://d.puremagic.com/issues/show_bug.cgi?id=4272
--- Comment #7 from Maxim Fomin <maxim at maxim-fomin.ru> 2012-10-07 01:08:41 PDT ---
(In reply to comment #6)
> (In reply to comment #5)
> > The problem is that UFCS was made to work with functions and typeof is not a
> > function. Accepting identifier.typeof would result in questions about which
> > identifiers are valid for this and what else works besides typeof with them.
>
> This is not to do with UFCS. There are already many built in properties like
> x.sizeof, x.init:
> http://dlang.org/property.html
>
> typeof fits nicely as a built in property, and helps cut down on nested
> brackets.
Typeof is not a property either. And it differs from all those properties
which, given a type or expression, provide fundamental information about their
types like size, default value, name, alignment. Typeof works in opposite
direction - given some expression it gives its type.
BTW, identifier is a primary expression (http://dlang.org/expression.html), so,
making idenfier.typeof possible and expression.typeof not (as mentioned above),
raises some questions.
However, if typeof is made a property too, it would be logical and consistent.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list