3 ms·
In Smalltalk, nil was a constant that contained the only instance of the class UndefinedObject. What some people did, was to put methods on UndefinedObject to
by stcredzero 6y ago
In Smalltalk, nil was a constant that contained the only instance of the class UndefinedObject.
What some people did, was to put methods on UndefinedObject to implement a "NullObject" pattern for their domain objects. Since everything is default initialized to nil, everything would just work.
The big downside of this, were beginners putting methods on UndefinedObject that they should not have. There's a thin line of conceptual understanding between a bit-bucket that hides errors from you, and a useful NullObject. Some people would call this a "dirty hack" for that reason.