--1926193751-1451961309-1188989512699
Content-Type: MULTIPART/MIXED; BOUNDARY="1926193751-1451961309-1188989512=:1699"

  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.

--1926193751-1451961309-1188989512699
Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed
Content-Transfer-Encoding: QUOTED-PRINTABLE

Hi --

On Wed, 5 Sep 2007, Peñá, Botp wrote:

> From: Robert Klemme [mailto:shortcutter / googlemail.com]
> # 2007/9/4, Yossef Mendelssohn <ymendel / pobox.com>:
> # > If '"x+=1" will always be "x=x+1"', what's the problem in
> # having x ||=
> # > 1 always be x = x || 1?
> # That an assignment of x=x is useless (basically a nop in the standard
> # case of x being a variable).
>
> consider,
>
> irb(main):074:0* h=Hash.new
> => {}
> irb(main):075:0> h[5] = h[5]
> => nil
> irb(main):076:0> h
> => {5=>nil}
> irb(main):062:0* h=Hash.new(1)
> => {}
> irb(main):063:0> h[5] = h[5]
> => 1
> irb(main):064:0> h
> => {5=>1}
>
> thus h[k] = h[k] could mean
>    h[k] = h.default   or
>    h[k] = nil
>
> definitely not useless and not noop.

It's really always h[k] = h.default -- it's just that the default
default, so to speak, is nil.


David

-- 
* Books:
   RAILS ROUTING (new! http://www.awprofessional.com/title/0321509242)
   RUBY FOR RAILS (http://www.manning.com/black)
* Ruby/Rails training
     & consulting:  Ruby Power and Light, LLC (http://www.rubypal.com)
--1926193751-1451961309-1188989512699--
--1926193751-1451961309-1188989512699--