Unary - Binary message

Bijan Parsia bparsia at email.unc.edu
Thu Oct 25 05:41:24 UTC 2001


On Thu, 25 Oct 2001, Gary McGovern wrote:
[snip]
> > "Gary McGovern" <garywork at lineone.net> wrote:
> > I'd like to ask a serious question without being pelted with rotten =
> > tomatoes. I've been trying to write an unary message to increment an =
> > integer (++ but don't tell anyone :-)).

No pelting, but I will ask "why?" Richard & Alan already provided loads of
other stuff, but I have no idea if it meets your needs, mainly because I
don't know what your need *are* :)

I guess now that I've written some Python 2.0, I have used a language with
"increment". But usually, if I want to do something like that, I do ye old
	a := a+1

Or some such.

When you mentioned Integer arrays, I began to wonder if you were using it
to step over an array...there are lots better techniques. (E.g., if you
use a stream over the array you can send #next messages to your heart's
content or #atEnd. If you are processing the items in a collection, then
#do, #collect:, etc. are your friends.)

If you're just trying to write an incrementer, then Richard's example will
do. If you're writing it for some purpose, maybe a few details will pull
out a better way to do it.

Cheers,
Bijan Parsia.





More information about the Squeak-dev mailing list