www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Typedef.toString?

reply Denis F <denis.feklushkin gmail.com> writes:
Hello!

After replacing native type by std.typecons.Typedef I am faced 
with fact what all typeDefValue.to!string was silently changed 
its output to output of Typedef struct itself. It was too hard 
find all this inclusions.  Maybe it is need to implement simple 
toString method inside of Typedef struct? Or just disable it at 
all?
Feb 22 2018
parent reply Meta <jared771 gmail.com> writes:
On Thursday, 22 February 2018 at 19:56:13 UTC, Denis F wrote:
 Hello!

 After replacing native type by std.typecons.Typedef I am faced 
 with fact what all typeDefValue.to!string was silently changed 
 its output to output of Typedef struct itself. It was too hard 
 find all this inclusions.  Maybe it is need to implement simple 
 toString method inside of Typedef struct? Or just disable it at 
 all?
Yes. I doubt this behaviour is intended, so it's likely an oversight in Typedef's implementation.
Feb 22 2018
parent reply Denis F <denis.feklushkin gmail.com> writes:
On Thursday, 22 February 2018 at 20:26:17 UTC, Meta wrote:

 find all this inclusions.  Maybe it is need to implement 
 simple toString method inside of Typedef struct? Or just 
 disable it at all?
Yes. I doubt this behaviour is intended, so it's likely an oversight in Typedef's implementation.
Should be disabled also: factory opCmp opEquals toHash ?
Feb 23 2018
parent reply Meta <jared771 gmail.com> writes:
On Friday, 23 February 2018 at 13:56:35 UTC, Denis F wrote:
 On Thursday, 22 February 2018 at 20:26:17 UTC, Meta wrote:

 find all this inclusions.  Maybe it is need to implement 
 simple toString method inside of Typedef struct? Or just 
 disable it at all?
Yes. I doubt this behaviour is intended, so it's likely an oversight in Typedef's implementation.
Should be disabled also: factory opCmp opEquals toHash ?
No, Typedef just needs a custom implementation of `toString`.
Feb 23 2018
parent Denis F <denis.feklushkin gmail.com> writes:
On Friday, 23 February 2018 at 15:26:02 UTC, Meta wrote:
 On Friday, 23 February 2018 at 13:56:35 UTC, Denis F wrote:
 On Thursday, 22 February 2018 at 20:26:17 UTC, Meta wrote:

 find all this inclusions.  Maybe it is need to implement 
 simple toString method inside of Typedef struct? Or just 
 disable it at all?
Yes. I doubt this behaviour is intended, so it's likely an oversight in Typedef's implementation.
Should be disabled also: factory opCmp opEquals toHash ?
No, Typedef just needs a custom implementation of `toString`.
I lean towards the idea to disable toString at all. Because if we wrap string type into it, string can leave Typedef wrapper unhindered.
Feb 23 2018