On Thu, 2009-05-14 at 08:10 +0200, Hans Dockter wrote: [ . . . ] > > a list, etc. Used in that context it is idiomatic. Used simply to > > replace a call of a method that doesn't have inserter semantics, it is > > probably a bad thing to do. > > Could you explain a bit more what you mean with the last sentence?
The analogy is basically that << should never replace assignment or a
named action other than append if it is to be being used idiomatically.
So
x = [ ]
x << a
is fine since the semantics are inserter semantics, the value a is being
appended to x; << replaced append:
x.append ( a )
If << simply replaces a non appending method call then it is being used
outside its idiomatic meaning and so will lead to misreading of
programs.
doFirst and doLast are appending methods, they append new actions to the
hook. So << has a natural position somewhere here. The question is
whether it should replace doFirst or doLast. The problem is that it
cannot be used with both, it can only be used with one. The doubt leads
to a cogent argument that perhaps it shouldn't be used with either.
Ambiguity leads to ambivalence :-(
--
Russel.
============================================================
Dr Russel Winder Partner
Concertant LLP t: +44 20 7585 2200, +44 20 7193 9203
41 Buckmaster Road, f: +44 8700 516 084 voip:
sip:[email protected]
London SW11 1EN, UK. m: +44 7770 465 077 xmpp: [email protected]
signature.asc
Description: This is a digitally signed message part
