logo       

Re: block in recursion, Any cure for that kind of situation?: msg#00103

lang.smalltalk.squeak.beginners

Subject: Re: block in recursion, Any cure for that kind of situation?

>>>>> "Hilaire" == Hilaire Fernandes <hilaire@xxxxxxxxx> writes:

Hilaire> I got an error "Attempt to evaluate a block that is already being
evaluated",
Hilaire> when I call in recursion a block like

Hilaire> carre := [:s1 :s2 :s3 :s4 :n |
Hilaire> n >0 ifTrue:
Hilaire> [carre valueWithArguments: {(segment value: s1 value:
s2).
Hilaire> (segment value: s2 value: s3).
Hilaire> (segment value: s3 value: s4).
Hilaire> (segment value: s1 value: s4).
Hilaire> n-1}]]

This is a maintenance nightmare waiting to happen. Use a proper method call,
perhaps creating a "manager" class to manage the workflow, and so you don't
have to keep passing segment around.

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@xxxxxxxxxxxxxx> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise