Why both isSafe and isUnsafe?
Steven Schveighoffer
schveiguy at gmail.com
Mon Sep 28 04:00:33 UTC 2020
On 9/27/20 11:00 PM, Andrei Alexandrescu wrote:
> https://dlang.org/phobos/std_traits.html#isSafe
> https://dlang.org/phobos/std_traits.html#isUnsafe
>
> Implementation:
>
> template isUnsafe(alias func)
> {
> enum isUnsafe = !isSafe!func;
> }
>
> Why do we need both?
They were both added in one PR. 10 years ago.
Probably don't need both. But just undocument the second, and leave it.
It's not a harm to leave it in and then it won't break code. Can also
now be shrunk to a short form:
enum isUnsafe(alias func) = !isSafe!func;
-Steve
More information about the Digitalmars-d
mailing list