Non-null objects, the Null Object pattern, and T.init

Regan Heath regan at netmail.co.nz
Fri Jan 17 04:51:38 PST 2014


On Fri, 17 Jan 2014 05:29:05 -0000, H. S. Teoh <hsteoh at quickfur.ath.cx>  
wrote:
> Now, if we modify this sentinel to instead record the location of the
> code that first initialized it (via __FILE__ and __LINE__ default
> parameters perhaps), then we can set it up to print out this information
> at a convenient juncture, so that the source of the uninitialized
> reference can be determined. *Then* perhaps it will be a start of a
> solution to this issue. (Though it still has limitations in the sense
> that the problem can only be caught at runtime, whereas some cases of
> null dereference preferably should be caught at compile-time.)

So.. if we had a base class for all objects which obtained the file and  
line when created by assignment (from init) and threw on any dereference  
(opDispatch) that would do it, right?

R

-- 
Using Opera's revolutionary email client: http://www.opera.com/mail/


More information about the Digitalmars-d mailing list