Hi,

Null coalesce operator - returns the first not nil operand.
http://en.wikipedia.org/wiki/Null_coalescing_operator

Adding one simple method to an Object:

?? anObject
>  ^ self


and to UndefinedObject:

?? anObject
>  ^ anObject


could allow us to write:


> default1 := nil.
> default2 := nil.
> default3 := 'foo'.
> default4 := 'don''t care'.
> config := default1 ?? default2 ?? default3 ?? default4.


=> 'foo'

I know you don't like to add new methods to an object, but still :)

Reply via email to