digitalmars.D - What is Tdummy doing in (may|does)PointTo?
- Andrei Alexandrescu (11/11) Apr 14 2016 https://dlang.org/library/std/exception/may_point_to.html
- Vladimir Panteleev (8/17) Apr 14 2016 Generally, if you don't understand why something is there, you
- Andrei Alexandrescu (14/30) Apr 14 2016 I know, but my point is that shouldn't be the way. Rationale for why
- Vladimir Panteleev (10/16) Apr 14 2016 I don't disagree with that. But another argument is that finding
https://dlang.org/library/std/exception/may_point_to.html https://dlang.org/library/std/exception/does_point_to.html We have an unfortunate pattern in Phobos: things that start out as simple ideas with nice implementations (in this case pointsTo) slowly change into complicated artifacts with undocumented rationale. We really should rein in documentation, not only external but also internal. In this case I cannot for the life of me figure what Tdummy does, and the only appearance of the name is in the respective definitions. Not to mention it uses incorrect spacing ("Tdummy=void", should be "Tdummy = void") :o). Andrei
Apr 14 2016
On Thursday, 14 April 2016 at 18:47:41 UTC, Andrei Alexandrescu wrote:https://dlang.org/library/std/exception/may_point_to.html https://dlang.org/library/std/exception/does_point_to.html We have an unfortunate pattern in Phobos: things that start out as simple ideas with nice implementations (in this case pointsTo) slowly change into complicated artifacts with undocumented rationale. We really should rein in documentation, not only external but also internal. In this case I cannot for the life of me figure what Tdummy does, and the only appearance of the name is in the respective definitions.Generally, if you don't understand why something is there, you could... 1. git blame 2. Delete it and see which tests fail :) In this case it appears to be used to disambiguate between the overloaded template.
Apr 14 2016
On 04/14/2016 02:50 PM, Vladimir Panteleev wrote:On Thursday, 14 April 2016 at 18:47:41 UTC, Andrei Alexandrescu wrote:I know, but my point is that shouldn't be the way. Rationale for why something is there should be in there, not in the accumulated history of commit explanations.https://dlang.org/library/std/exception/may_point_to.html https://dlang.org/library/std/exception/does_point_to.html We have an unfortunate pattern in Phobos: things that start out as simple ideas with nice implementations (in this case pointsTo) slowly change into complicated artifacts with undocumented rationale. We really should rein in documentation, not only external but also internal. In this case I cannot for the life of me figure what Tdummy does, and the only appearance of the name is in the respective definitions.Generally, if you don't understand why something is there, you could... 1. git blame2. Delete it and see which tests fail :) In this case it appears to be used to disambiguate between the overloaded template.Thanks. That's the shared overload. Isn't there a much better solution? Why isn't shared handled inside the body along with the other cases? Also, why is this: foreach (i, Subobj; typeof(source.tupleof)) if (mayPointTo(source.tupleof[i], target)) return true; not written easier like this: foreach (ref member; source.tupleof) if (mayPointTo(member, target)) return true; ? Andrei
Apr 14 2016
On Thursday, 14 April 2016 at 18:56:19 UTC, Andrei Alexandrescu wrote:I know, but my point is that shouldn't be the way. Rationale for why something is there should be in there, not in the accumulated history of commit explanations.I don't disagree with that. But another argument is that finding out the reason (by deleting it and looking at the error messages) took me less time than it took you to write this thread.Thanks. That's the shared overload. Isn't there a much better solution? Why isn't shared handled inside the body along with the other cases?I have not even been aware of this function's existence before this thread, so I'll let someone else answer that. Perhaps finding the author is the use case for git blame. (This is one reason why I think people should be reachable by PR comments even after PRs are merged, BTW.)
Apr 14 2016