DIP1000: Walter's proposal to resolve ambiguity of ref-return-scope parameters
Paul Backus
snarwin at gmail.com
Fri Nov 26 02:08:54 UTC 2021
On Friday, 26 November 2021 at 01:48:28 UTC, zjh wrote:
> On Thursday, 25 November 2021 at 22:36:38 UTC, Walter Bright
> wrote:
>
>> I've suggested removing `lazy` already, with the predicted
>> response.
>
> `lazy` can be deleted completely. One can replace it with
> something similar to the `concept` of C++.
There's one use of `lazy` that can't be easily replaced, which is
template functions like [`std.exception.ifThrown`][1]. Without
`lazy`, we would have to rewrite code like this
```d
auto result = doStuff(x, y, z).ifThrown(w);
```
...to look like this:
```d
auto result = (() => doStuff(x, y, z)).ifThrown(w);
```
Personally I don't think this is a huge deal--`lazy` is not very
commonly used in the first place, and having to write a few extra
characters in the places where it is used is not a terrible
imposition. But it is still a breaking change.
[1]: https://phobos.dpldocs.info/std.exception.ifThrown.1.html
More information about the Digitalmars-d
mailing list