September 27, 2020 Why both isSafe and isUnsafe? | ||||
---|---|---|---|---|
| ||||
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? |
September 28, 2020 Re: Why both isSafe and isUnsafe? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | 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
|
Copyright © 1999-2021 by the D Language Foundation