Templates: generic "return null;"

Dicebot public at dicebot.lv
Mon Feb 3 06:23:56 PST 2014


On Monday, 3 February 2014 at 14:21:29 UTC, Dicebot wrote:
> This is intended. The very point of Nullable is to force you to 
> handle `null` state before accessing actual payload.

P.S. for this very reason in my own implementation of Optional I 
provide only delegate access method:

value.get(
     ()    => { /* handle 'empty' case */ },
     value => { /* 'value' is legit data */ }
);


More information about the Digitalmars-d-learn mailing list