>     MyNullClass>>#ifNil: nilBlock ifNotNil: notNilBlock
>         nilBlock value.
>
> Any ideas?

I've got a slightly different understanding of the null object
pattern, perhaps. I would use it this way:

MyClass is an abstract class that defines an interface that users
would expect, with a subclass MyNullClass and MyConcreteClass.

Where ever I send messages to the "MyClass", it could either be an
instance of MyNullClass or MyConcreteClass. MyNullClass would
implement the protocol of MyClass, but would behave differently. This
is so that the users /senders of MyClass do not have to do if's to
determine if it's talking to a null object or not.

And this is where I wonder if I will try to implement the ifNil
behviour on MyNullClass at all, because the senders have to know about
the kind of thing it is talking to.

But perhaps this is a different context.

Otto

Reply via email to