Smart pointers instead of GC?

Dicebot public at dicebot.lv
Wed Feb 5 09:20:13 PST 2014


On Wednesday, 5 February 2014 at 17:09:31 UTC, Meta wrote:
> If null becomes an invalid value for object references and 
> pointers, then we can use it to unambiguously mean "item does 
> not exist", and it becomes Just Another Value, so it is useful 
> to transfer in various circumstances.

Yes, in that cases you transfer it as Nullable!T which is 
supposed to be single generic way to pass both value and 
reference types that can possibly be undefined.

Judging by typical code I see though, such "does not exist" case 
is most commonly processed as

if (!param)
     return; // return null;

So if `param` becomes non-nullable you simply don't call 
processing function for null cases.


More information about the Digitalmars-d mailing list