> So I had a moment of disgust over all the nil object checking I'm doing when
> grabbing values that may or may not be present in a multi-level hash.
[...]
> Why not just define [] on NilClass and be done with it?
[...]
> The purist in me revolts a little bit at this idea. But the pragmatist would
> love to quit making all these nil object checks when I really don't care
> about them.

This is very lispy; I approve.

* (eq nil '())
t
* (car nil)
nil
* (cdr nil)
nil

see also A Short Ballad Dedicated To The Growth Of Programs, by Ashwin Ram:

http://edward.oconnor.cx/2002/04/lisp-v-scheme


Ted

--~--~---------~--~----~------------~-------~--~----~
SD Ruby mailing list
[email protected]
http://groups.google.com/group/sdruby
-~----------~----~----~----~------~----~------~--~---

Reply via email to