What is the purpose of replacing expressions, used as limits in a
to:do: call with by a new temporary variable?
For example:
OCOpalExamples>>#exampleToDoArgumentLimitIsExpression
the code is
exampleToDoArgumentLimitIsExpression
������ | count sum |
������ count := 10.
������ sum := 0.
������ 1 to: count - 1 do: [ :each | sum := sum + each].
������ ^sum
the decompiled bytecode :
exampleToDoArgumentLimitIsExpression
������ | tmp1 tmp2 tmp3 |
������ tmp1 := 10.
������ tmp2 := 0.
������ tmp3 := tmp1 - 1.
������ 1 to: tmp3 do: [ :tmp4 | tmp2 := tmp2 + tmp4 ].
������ ^ tmp2