Brandon Allbery via RT wrote:
>Erm. Isn't Nil a silent Failure?

It may well represent such a thing, but it is also a reified object.
Putting objects into sets is an operation that's applicable to any kind
of object, and which (for comparison) does in fact work on objects of the
Failure class.  Expecting an object to be propagated doesn't assert that
it doesn't represent failure; rather, it's just embracing the reification.
The great benefit of reification is that the object can be processed in
all the familiar ways that are used on ordinary value objects.

If you want to impose a restriction that failure objects can't go into
some of the places I've tried to put Nil, then in some cases that would
be a sensible decision.  It would make perfect sense to restrict Range
endpoints, for example, but it doesn't make any sense to restrict the
domain of Sets.  But in any case, wherever such a restriction is desirable
it should be enforced by signalling an exception: silently substituting
a different value sucks.  And if your logic for rejecting Nil is that
it represents failure, then presumably the same logic would lead you to
reject objects of the Failure class too, and maybe also Exception.

-zefram

Reply via email to