[Issue 4272] x.typeof syntax

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Oct 6 06:53:05 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=4272


Maxim Fomin <maxim at maxim-fomin.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |maxim at maxim-fomin.ru


--- Comment #5 from Maxim Fomin <maxim at maxim-fomin.ru> 2012-10-06 06:41:10 PDT ---
(In reply to comment #4)
> (In reply to comment #3)
> > typeof isn't a property or a function, unlike sizeof. It's like an
> > is-expression, and I think that treating it like a property would be a mistake.
> 
> I think (x + y).typeof should not be allowed, use the existing syntax instead.
> 
> However, x.typeof is a useful shorthand that helps cut down on nested brackets
> in is expressions and elsewhere. So I would allow both typeof(expression) and
> identifier.typeof to be used, but *not* expression.typeof.
> 
> The type of an instance is a natural property of the instance IMO.

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.

-- 
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