Optional and orElse: design feedback/critique?

aliak something at something.com
Sun Jul 28 03:13:08 UTC 2019


On Saturday, 27 July 2019 at 17:01:14 UTC, SimonN wrote:
> It's surprising that pointers and references are special-cased 
> differently, right.
>
> But I suggest that null is the same as empty, both for pointers 
> and for references. I.e., the original post's proposal should 
> change its pointer semantics, some!(int*)(null) == no!(int*).
>
> What was the original reason to treat pointers and class 
> references differently?

I only have a fuzzy recollection of something along the lines of: 
"null can be a valid return type of a function, and maybe there's 
an error and I want to return nothing". But, I can see how that 
thought is a bit... unconvincing right now.

So yeah, bottom line, I'll fix the inconsistency as you suggest 
as I think that sounds more reasonable then what it currently is.

Chur!





More information about the Digitalmars-d mailing list