[GOODIE] Arithmetic assignments (+= and friends)

Bert Freudenberg bert at isg.cs.uni-magdeburg.de
Mon Jun 17 13:47:43 UTC 2002


On Mon, 17 Jun 2002, Andreas Raab wrote:

> > and does not interfere with the ability 
> > to write binary selectors *= etc (not that I would want to, but
> > until now you could).
> 
> Well, the only uses I've seen sofar were inplace operations (and I wrote
> 'em ;-) Note that the ability to write binary selectors of this form
> could be obtained by seeing if the left hand side is a variable (then,
> the only requirement for the implementation would be that it returns
> self) but it appears to me that it's a somewhat useless exercise...

I don't have a nice solution, but there are situations in which it would
be usefull to distinguish between :+= (which expands to := and +=) and +=
(a normal message send). Like, when the receiver itself is a parameter
instead of a temp. I think it's not too far-fetched to use an inplace
modifying loop like

	coll do: [:each | each += something]

which would not work anymore with your approach. 

-- Bert




More information about the Squeak-dev mailing list