benny wrote:
and I hope that you have read that it don’t exist a method=20
Hash#unshift 
I know “unshift” only from php. what do you want to tell me with this state=
ment?
should I better stay programing php?
Notice there is a smiley. Apparently a small joke.
I guess when you said “shift” you meant << (which looks like
the numeric shift operator) rather than the actual method
named shift (whose opposite is unshift).
no I meant the method “shift” and indeed there is no method “unshift” for hashes (in ruby, in php,
there is).
I refered to the method “shift” because Mr. Decoux stated
“(order is given by the hash value, and not
by the last element added)”
to say that you can’t use << for hashes.
I’m not shure if I got him right. I thought he said
“the order of the new element in the array when using [“a”] << “b” is given by the array , so that
the added element is always the last one. how would that be in a hash, where we have a key?”
and I wanted to tell him
“I always thought the order doesn’t matter in a hash as you can see be the unpredictability of the
result of the method shift.”
I think this minor misunderstanding is only the result of
a French person and a German person conversing in English.
I think its more the aim of minimalistic communication that leads to confusion.
nevertheless my proposal wasn’t {“a” => “b”} << “c => d” (analog to [“a”] << “b” ) but
{“a” => “b”} << {“c” => “d”}
(see my other posting).
and the argument that this would mean another thing than with arrays (adding an association instead
of an element) I think is not so important because, Hash is an other Object than Array and can
handle << in its own useful way (as String and Fixnum also do).
Cheers,
Hal
ps. I saw the smiley just wanted to know if I interpreted the allusion “unshift” the right way.
cheers,
benny
···
Am Wed, 28 Jan 2004 03:45:35 +0900 schrieb Hal Fulton hal9000@hypermetrics.com: