dblack / wobblini.net wrote:
> Hi --
> 
> On Tue, 24 Jan 2006, Kevin Olbrich wrote:
...

> 
> (A class with an attribute called "text"?)
> 
>> you could set up missing_method to pick up 'iText' and return
>> 'Text.to_i' or 'hText' could return 'h(Text)' etc...
> 
> 
> Why not just call to_i or h in the first place? :-)
> 

Aesthetics?  Encapsulation? Hiding implementation details?  Amusement?

I've seen code that takes find_by_foo( bar ) and converts it into find( 
:foo => bar ) or some such thing.  Is this to save typing (he asked 
rhetorically)?  Expression of intent?  Slickitude factor ("Ha! Try THAT, 
Java droids!" )?  (Still rhetorical; please, no flames.)

I showed this as part of  a Ruby demo, and at least one person didn't 
see what that bought you.  Fair enough.  I tend to like it, though.

hText (though h_text or text_h looks more Rubyish) is just another 
example of embedding code in message names.

But it can teeter toward DSL: domain-specific logorrhea.

foo.baz_then_bar_unless_bif_equals_47

James Britt

-- 

http://www.ruby-doc.org       - Ruby Help & Documentation
http://www.artima.com/rubycs/ - The Journal By & For Rubyists
http://www.rubystuff.com      - The Ruby Store for Ruby Stuff
http://www.jamesbritt.com     - Playing with Better Toys
http://www.30secondrule.com   - Building Better Tools