[Newbies] block in recursion, Any cure for that kind of situation?
Randal L. Schwartz
merlyn at stonehenge.com
Tue Jan 22 23:12:01 UTC 2008
>>>>> "Hilaire" == Hilaire Fernandes <hilaire at ofset.org> 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 at stonehenge.com> <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!
More information about the Beginners
mailing list