From: Robert Klemme Date: 2004-01-28T18:29:54+09:00 Subject: Re: newbee question about "missing" hash methods +, += and << "benny" schrieb im Newsbeitrag news:20040127192241.26396079@bava.ho... > > > > No. Arguments are: > > > > "+" is inefficient. (same for "-") > > dito with > "string" += "other_string" Yes. > > "<<" has usually the semantics that the left side is a collection while > > the right side is an element. And since each entry in a Hash needs a key > > value pair this could not be done with <<, because "<<" can only have a > > single argument. > > what about > > "a" << "bcd" True. String is special with respect to <<. > > What should it do if the Hash contains Hashes as keys? This is highly > > ambiguous and not intuitive. > > no, its quite clear: it happens the same thing like > > myhash[{"key" => "val"}] = "other_val" No, we were talking about "-": If h is a Hash that contains hashes as keys like h = { {"foo"=>"bar"} =>1 } then how is "h - x" interpreted if x is a Hash? It's ambiguous. Regards robert