Jamey Cribbs wrote:
> James Edward Gray II wrote:
> 
>>
>>
>> I realized, after I sent that, that my solution is *not* equivalent.   
>> Guess that's a good argument for your way of doing things Jamey.  ;)
> 
> Well, I just wanted to thank you for starting this whole discussion.  I
> *really* like getting feedback on KirbyBase and your post has resulted
> in some great ideas from people concerning this nil issue.
> 
> Bottom line is that I'm going to work on finding a way to satisfy your
> request to not override NilClass#method_missing while keeping the
> simplicity of KirbyBase's query expressions.

I may be jumping in the deep dark waters of overengineering,
but how about just proxying the call? Instead of:

  r.speed        # => 3

You would have

  r.speed        # <#KBDBField:0x...>
  r.speed.value  # 3
  r.speed + 1    # 4

The KBDBField (it is just fun to say fast) proxies all of
its requests to the value object unless said object is nil.

Alternatively, NULL = NullClass.new is not a terrible idea :)

> Thanks again for bringing this up.
> 
> Jamey


E

-- 
Posted via http://www.ruby-forum.com/.