[Issue 1412] stringof shouldn't be shadowed by member func

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue May 27 15:29:22 PDT 2008


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


brunodomedeiros+bugz at gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |brunodomedeiros+bugz at gmail.c
                   |                            |om




------- Comment #5 from brunodomedeiros+bugz at gmail.com  2008-05-27 17:29 -------
But unlike "init" or others, stringof is not a real property, nor anything like
it. It is a special, meta-programming construct that has a syntax like a
property, but behaves quite differently from a property, due to the fact that
the stringof expression is never evaluated. For example such expression:
  (new Foo()).stringof
does not create a new Foo.
That alone shows the difference in semantics. It's not even possible to define
a custom stringof property that behaves like the original stringof!
So the language should not allow "redefining" the stringof property. It should
be the same as sizeof, which cannot be redefined (and also does not evaluate
it's expression).

(One could also suggest that a free function syntax, ie: "sizeof(new A())",
should be allowed, and maybe even prefered)


-- 



More information about the Digitalmars-d-bugs mailing list