Hi --

On Mon, 20 Jul 2009, 7stud -- wrote:

> David A. Black wrote:
>> Hi --
>>
>> On Mon, 20 Jul 2009, 7stud -- wrote:
>>
>>> David A. Black wrote:
>>>> I'm not sure what that buys you, though.
>>>
>>> Simplicity of comprehension over brevity.
>>
>> I guess I like the ||= idiom because it has both.
>
> For you, yes.  But apparently not for the op:
>
>>> I was trying to figure out how to use a hash but did not
>>> make the leap to the ||= construction on my own.

I wouldn't recommend freezing one's knowledge or leap abilities at a
particular point, though :-) I'm certainly in sympathy with being
suspicious of punctuation-heavy stuff, but in the case of ||= it's
such a common idiom, and so easy to learn, that it seems like a bit of
an artificial hardship not to learn it. Still, if will work too :-)

>> The ||= idiom should work
>> fine
>
> ..until it doesn't (I think you know what I'm refering to).

The hash default thing? I don't think that comes into play here, does
it?


David

-- 
David A. Black / Ruby Power and Light, LLC
Ruby/Rails consulting & training: http://www.rubypal.com
Now available: The Well-Grounded Rubyist (http://manning.com/black2)
Training! Intro to Ruby, with Black & Kastner, September 14-17
(More info: http://rubyurl.com/vmzN)