error: 'Attempt to evaluate a block that is already being evaluated.'

Matej Košík kosik at fiit.stuba.sk
Sun Aug 21 22:51:44 UTC 2005


Michal wrote:
>>Is there a way how to make the above code to work?
> 
> 
> Clone your block before evaluating it. The following works for me:
> 
>     factorial := [:n | n <= 1
>                          ifTrue: [1]
>                          ifFalse: [n * (factorial clone value: n - 1)]
>                  ].
> 
>     factorial clone value: 1

This works. It is a nice experiment.

The need for `clone' is not very pleasant, but this solution is close to 
what my friend was looking for.

Thank you.
-- 
Matej Košík



More information about the Squeak-dev mailing list