Hi there.

I am probably not the first, and will not be
the last person to come up
with this suggestion, neverTheLess:

To increment a numeric value I would like to write:

aNum := 1.
aNum ++.             to increment it
aNum --.             to decrement it

instead of:
aNum := aNum + 1.

For reasons of efficiency and readability.

Why?
Most, if not all, of today's computer processors
( they used to be called microprocessors :o)
have INCrement en DECrement instructions,
which are much more efficient than addition
and subtraction instructions.
(less clock cycles, perhaps even just one)

Of course, the work should to be done by primitives,
which directly utilizes the processor's INC, DEC instructions.

So, wouldn't it be convenient to implement these ++ and ---
methods in Pharo? and VM.  I am not sure, but I suspect also a number
of system classes e.g. in     do: [:i|...]   would perform better,
wenn this method/ instruction is supported?

?

Kind Regards
Ted
Currently making/learning Pharo/Seaside app.

Reply via email to