From: Phrogz Date: 2007-02-17T03:50:06+09:00 Subject: Re: Oppinions on RCR for dup on immutable classes From: SonOfLilit [mailto:sonoflilit@gmail.com] Sent: Friday, February 16, 2007 10:48 AM > Ruby is always about principle-of-least-surprise and this behavior > really surprised me when I first read about it non-list (I've stayed > away from object copies in MY code, because it all seems so hacky and > arcane to me... Truns out it was a good idea) Actually, Ruby is about the principle-of-least-surprise-for-matz. I used to think POLS applied to everyone when I started with Ruby. Many people, including Matz, pointed out that it's impossible to make things unsurprising to everyone, because people will be surprised by different things. Just because something is surprising to you doesn't mean that it should be changed in Ruby. You are advised (as was I) not to use POLS as justification for why something should be changed. ... Having said that, I personally would prefer for 3.dup to 'just work', returning an object that is equivalent to the original. Just because the new instance happens to be the same doesn't mean that it's bad - as an immutable object, the only way to tell is via object_id, anyhow.