Recursion

Shari gypsyware at earthlink.net
Thu Aug 29 16:18:00 EDT 2002


Thank you, Brian.  Very nice explanation.

I remember you from the Yennie externals collection for Hypercard.  I 
still have them filed away in my Hypercard helpers folder :-)  Now 
collecting dust as I've migrated to Metacard...

It's nice to use a program that doesn't need a bunch of externals! 
Very happy with Metacard :-)

It's opened up a world of possibilities!  Once the new blackjack game 
comes out, you can see side by side how it compares to the original 
Hypercard blackjack game.  Just the ability to have color animations 
is very happy!



>It shouldn't. What happens is this:
>
>1. theHandler is triggered.
>2. A message is queued to trigger theHandler again.
>3. theHandler finishes executing.
>4. theHandler is triggered by the pending message.
>
>As you can see, the first copy of the handler completes and exits in 
>step 3. Thus, you only have one copy of the handler in memory at 
>once.
>
>On the other hand, this:
>
>on theHandler
>     # do things
>     theHandler
>end theHandler
>
>Produces this result:
>
>1. theHandler is triggered.
>2. theHandler calls a second copy of itself.
>3. The second copy calls a third.
>4. The third copy calls a fourth.
>...
>
>After 4 steps there are 4 handlers in memory, and you are recursing. 
>The first copy can't release until the second does, the second is 
>waiting for the third, the third is waiting on the fourth, etc. 
>Until all of those handlers start terminating without recursing any 
>further, you'll just keep on eating memory- and Metacard will bail 
>you out with an error.
>
>HTH,
>Brian

-- 
--Shareware Games for the Mac--
http://www.gypsyware.com



More information about the metacard mailing list