Bug 5404 – .stringof is not documented

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dlang.org
Product
D
Version
D2
Platform
Other
OS
All
Creation time
2011-01-03T12:48:00Z
Last change time
2013-01-11T19:54:13Z
Assigned to
nobody
Creator
peter.alexander.au

Comments

Comment #0 by peter.alexander.au — 2011-01-03T12:48:09Z
The usage of .stringof on its own (with no preceding object) doesn't appear to be documented anywhere, yet it appears to be legal and returns the name of the module it resides in, e.g. in foo.d, it would evaluate to "module foo". This should be added to the language spec.
Comment #1 by peter.alexander.au — 2011-01-03T12:50:18Z
Also, if we are in module foo.bar, it returns "module bar". Is this correct behaviour?
Comment #2 by peter.alexander.au — 2011-01-03T13:02:17Z
Finally, is there any reason that the return value is prefixed with "module"? 1. I can't imagine any use for it. 2. If people needed it, it would be trivial to add ("module " ~ .stringof) 3. If they don't want it, it's a little trickier (splitter(.stringof)[1], or ugly .stringof[7..$]) I would recommend that in module foo, .stringof == "foo".
Comment #3 by andrej.mitrovich — 2013-01-11T19:54:13Z
*** This issue has been marked as a duplicate of issue 3007 ***