Motive behind !empty() with front() instead of Optional front()

Nick Treleaven nick at geany.org
Sat Mar 27 09:50:28 UTC 2021


On Saturday, 27 March 2021 at 01:06:37 UTC, Steven Schveighoffer 
wrote:
> That could be possible if the Optional type lazily fetches the 
> value/empty status, in which case now you are dealing with 
> delegates and/or closures. I don't think this is the right path.

You are of course right that returning an optional must eagerly 
fetch a value. I was just responding to you saying you have to 
check an optional is empty before accessing the value - you don't.


More information about the Digitalmars-d mailing list