"David A. Black" <dblack / wobblini.net> writes:

>>   def compensate(defaults)
>>     defaults.merge self
>>   end
>
> I'm curious what this gains you.  Is it better than just
> saying defaults.merge(self)?

Good point.  Come to think about it, I doubt if I ever used
the non-destructive variant.  I guess depending on your
taste it could be nicer when defaults is a hash literal and
self isn't.

   def foo1(options)
     bar { :moomin => 123 }.merge(options)
   end

   def foo2(options)
     bar options.compensate(:moomin => 123)
   end

The former is shorter and uses standard operations only,
but the latter is arguably conceptually simpler once you
get used to the compensate method.

Also, you could argue that if there's a °∆compensate!°«,
then there should also be a °∆compensate°«.

But yeah... :-)

-- 
Daniel Brockman <daniel / brockman.se>

    So really, we all have to ask ourselves:
    Am I waiting for RMS to do this?   --TTN.