|
Re: block in recursion, Any cure for that kind of situation?: msg#00111lang.smalltalk.squeak.beginners
Hi Hilaire, on Wed, 23 Jan 2008 09:49:07 +0100, you wrote:
You don't have to. I use recursive blocks in Smalltalk workspace all the time. The "trick" is from the Self language, which always clones activation record before using them. Example: recursiveBlock := [:argV | argV < 1 ifFalse: [argV + (recursiveBlock clone value: argV - 1)] ifTrue: [argV]]. recursiveBlock clone value: 17 You could send #copy instead of #clone but I prefer the latter in honor of Self. Enjoy! /Klaus P.S. beware of the #fixTemps symptom in Squeak's implementation of blocks, was discussed several times over in squeak-dev. Hilaire
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: block in recursion, Any cure for that kind of situation?, Hilaire Fernandes |
|---|---|
| Next by Date: | Getting NewCompiler/re-entrant blocks to work - Re: block in recursion, Any cure for that kind of situation?, Marcin Tustin |
| Previous by Thread: | Re: block in recursion, Any cure for that kind of situation?, Hilaire Fernandes |
| Next by Thread: | Re: block in recursion, Any cure for that kind of situation?, Hilaire Fernandes |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |