Is there anything other than nullable to work with optional types?

Stefan Koch via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Dec 25 12:01:21 PST 2016


On Sunday, 25 December 2016 at 19:22:10 UTC, aliak wrote:
> Hey,
>
> So, been using the programming language swift for a while now, 
> the optional types[1] they support makes working with 
> maybe-type (ala haskell) values extremely pleasant.
>
> [...]

Well there is one easy way to do this.
pass a pointer to the data.
Another easy one is the definition of one invalid set of values 
and using that is initial value and for convenience overload 
opCast(T:bool) to check against that instance.


More information about the Digitalmars-d-learn mailing list