Comment #5 by andrej.mitrovich — 2013-09-12T14:31:35Z
(In reply to comment #4)
> This has broken my library Orange, which is being integrated as
> std.serialization.
Using .stringof is very unreliable (precisely because of these sort of changes, and since .stringof isn't really properly defined).
I suggest using __traits(identifier, Foo.tupleof[0]) instead.
Comment #6 by k.hara.pg — 2013-09-12T18:31:45Z
(In reply to comment #5)
> (In reply to comment #4)
> > This has broken my library Orange, which is being integrated as
> > std.serialization.
>
> Using .stringof is very unreliable (precisely because of these sort of changes,
> and since .stringof isn't really properly defined).
>
> I suggest using __traits(identifier, Foo.tupleof[0]) instead.
Today stringof property merely prints the internal AST which its semantic analysis has been done.
And of course internal AST format does not have any backward compatibility beyond compiler releases.
(Note that compiler cannot determine the stringof property result before semantic analysis, because the property could be overridden by user-defined field.)
So the result format is not defined at all.
Comment #7 by doob — 2013-09-12T23:59:44Z
(In reply to comment #5)
> Using .stringof is very unreliable (precisely because of these sort of changes,
> and since .stringof isn't really properly defined).
>
> I suggest using __traits(identifier, Foo.tupleof[0]) instead.
I suspected that, that was why I didn't create a new bug report.
Comment #8 by doob — 2013-09-13T00:02:16Z
(In reply to comment #6)
> Today stringof property merely prints the internal AST which its semantic
> analysis has been done.
> And of course internal AST format does not have any backward compatibility
> beyond compiler releases.
>
> (Note that compiler cannot determine the stringof property result before
> semantic analysis, because the property could be overridden by user-defined
> field.)
>
> So the result format is not defined at all.
I understand that, but it has stayed the same of the last 6-7 years. This should be clearly stated in the documentation. Or it should be defined.
Comment #9 by andrej.mitrovich — 2013-09-13T06:49:43Z
.stringof representation has changed in many parts of the compiler, I guess this current usage of it had the biggest effect yet. I suggest we add a note in the documentation to avoid using .stringof for code-generation, and prefer things like __traits(identifier), or one of the Phobos helper functions such as "fullyQualifiedName".