Option and Result [was Integration tests]

aliak something at something.com
Tue Apr 21 21:29:06 UTC 2020


On Tuesday, 21 April 2020 at 16:30:15 UTC, Russel Winder wrote:
> On Mon, 2020-04-20 at 20:19 +0000, aliak via 
> Digitalmars-d-learn wrote:
>> 
>> […]
>
>> [0]: https://github.com/aliak00/optional
>
> Rust has Option and Result, and most languages are rapidly 
> introducing at least Option if not Result – and yes it is 
> almost certain all this comes from Haskell.

Yeah it's a great abstraction that's part of modern languages 
now. Some static languages are even building syntax for it right 
in (e.g. swift, kotlin, v, zig - to name a few).

There've been a few attempts at building a Result type:

https://code.dlang.org/search?q=expect
And here: 
https://github.com/aliak00/ddash/blob/master/utils/source/ddash/utils/expect.d

>
> Is Option intended for adding to Phobos?

Not that I am aware of. There was an attempt to PR an Option type 
way back when which never made it: 
https://github.com/dlang/phobos/pull/3915

There was a post here: 
https://forum.dlang.org/thread/hqtdekjtdgbhhbjgyvvo@forum.dlang.org




More information about the Digitalmars-d-learn mailing list