Programming: a reference that cannot be null

Mar 03 2010

In most (all?) object oriented programming languages it is possible to have a reference to an object and have this reference be null/nothing/nil.  There are many cases this isn’t a good idea; like for instance method signatures.

AddCustomer( Customer customer )

and customer is null.  Not very common…

It would be nice to have a reference type that cannot be null.  Ever.  The compiler should also know about this and break if the code flow allows the reference being null.

No responses yet

Leave a Reply