On Sunday 23 November 2003 03:10 pm, Tanaka Akira wrote:
> In article <200311230325.21687.transami / runbox.com>,
>
>   "T. Onoma" <transami / runbox.com> writes:
> > So the advantage is having less implementation code. In fact you could
> > write a whole class that had nearly zero assignment code and all
> > respond_to? activators. (That would be interseting to see actually.) On
> > the downsie it might have some small performance loss, and, of course,
> > we're simply not used to the idea.
>
> As Elliott pointed out, it has a problem with typo detection.
>
> As _why explained, typo detection is possible.  But it needs more
> code.
>
> So, the advantage "less implementation code" is not valid with typo
> detection.

I don't see how this is a big deal. When I first read this on Elliots post I 
thought "so?" You can mispell things anywhere and its going to break stuff. 
All you're pointing out is that no definite error is going to pop out and say 
"hey dodo, you made a typo!".  Well, guess what? That kind of bug happens all 
the time, especially in a dynamic language like Ruby. So I think that's a 
very very small point, and thus doesn't invalidate less code argument. 
Besides what do you do if no block is assigned?...more code.

Now what would really be intersting is a callback method: no_responer. When 
respond_to? returns false a detour is made to a no_responder callback method, 
if defined.  With appropriate args this could take care of the problem in one 
fell swoop.

My my... callbacks and duck typing? What will we think of next? :)

-t0