On Saturday, 28 May 2016 at 12:25:14 UTC, Lodovico Giaretta wrote:
On Saturday, 28 May 2016 at 11:57:09 UTC, Era Scarecrow wrote:
auto doSomethingDumb(T)(ref T t) if(isSafe!(T))
The problem is that T is a type, and I should check for safety
of every method of T that I'm using in my function. This does
not scale well, and if I change the body of the function to use
a new method, I may forget to add it to the isSafe checks.
Hmmm that doesn't sound right. Safe code can't call unsafe code
(or it shouldn't), it continues @safe/@trusted all the way down.
So if you are passed a safe/trusted function, then it shouldn't
need other checks.
Or am i reading the question wrong?