On 2/7/15 4:40 AM, David Nadlinger wrote:
On Friday, 6 February 2015 at 18:52:45 UTC, Andrei Alexandrescu wrote:
I think the problem is overstated. -- Andrei

I think there could hardly be a more persuasive argument that this
belief is wrong than Walter himself just having made the mistake several
times, and not even immediately realizing what is wrong:
https://github.com/D-Programming-Language/phobos/pull/2966 [1]

Sorry for singling out this one example here. While it is particularly
demonstrative, I am certainly not intending to put Walter in a bad
light. It's simply hard to get that stuff right, as templates can make
it hard to accurately determine the complete public interface of a
function. As pointed out in the PR, here are some more examples for this
class of bugs from Phobos code, also written and reviewed by top D coders:

https://issues.dlang.org/show_bug.cgi?id=14135
https://issues.dlang.org/show_bug.cgi?id=14136
https://issues.dlang.org/show_bug.cgi?id=14137
https://issues.dlang.org/show_bug.cgi?id=14138

Neither of those issues would have been prevented by your new
guidelines; the code in question is already written in that way. Quite
to the contrary, consequent application of minimal @trusted blocks or
even the workaround you reject so strongly would have prevented all of
the bugs except for 14138.

David


[1] The diff in question, for when the PR is fixed:
https://github.com/klickverbot/phobos/commit/db647f62cb5279ae42ad98665cd60cdcdb9b3dd5

Nice, thanks for this work. One good guideline here is to almost always let generic code rely on deduction instead of ascribing safety attributes to it.

Andrei

Reply via email to