returning different types via function

Dicebot public at dicebot.lv
Tue Nov 19 11:44:15 PST 2013


On Tuesday, 19 November 2013 at 19:31:41 UTC, bearophile wrote:
> A Nullable in usually efficient enough (there is even an 
> alternative Nullable that doesn't increase the data size), it 
> makes typing stronger, and it should become more common in 
> system languages (and indeed it's commonly used in Rust, where 
> the pattern matching makes its usage nicer). [] is a bad 
> indicator because perhaps ZZ could be empty, so you are mixing 
> signals.

I don't want to argue this in details right now but I think that 
simply banning null references as valid arrays in program as a 
whole via contracts is better approach than adding extra level of 
indirection via Nullable ;)


More information about the Digitalmars-d-learn mailing list