https://issues.dlang.org/show_bug.cgi?id=18374

--- Comment #2 from Mitu <the.mail.of....@gmail.com> ---
(In reply to Seb from comment #1)
> Are you aware of the new `apply`?
> 
> https://dlang.org/changelog/2.080.0.html#std-typecons-nullable-apply
> 
> It still would be great to have Nullable and ranges working nicely together,
> but at least apply is a start.

I am, but it wasn't there the day I have created this issue.

apply() definitely does the trick. It still lacks one case though - when we
want to call the void function unless the value is null:

---------------
Nullable!int something;
something.apply!writeln;
---------------

I still think that Nullable as a range might be more powerful and its
integration with the range behavior might be save some LoC in some places, but
I cannot come up of an example now.

--

Reply via email to