Destructive Recursion
April 4, 1998
by Alex Zavatone
One of the purchasers of my toolkit recently complaned that the object browser does not handle indirect circular recursion ie, it chokes rather completely. I told him that in objects referring to themselves through another this will happen till I write a fix but press command period and reopen the window with recursion turned off.
But that was not the case and he sent me a file. Not a big file, a simple little tiny file that assigned the following script to a variable called gTestObj:
property thisListFreezesDirector on new me set listA = [#name:"root", #level: 0, ¬ content:[], #parent:0] set listB = [#name:"elem1", #level: 1, ¬ parent:listA] set listC = [#name:"elem2", #level: 1, ¬ parent:listA] append the content of listA, listB append the content of listA, listC set thisListFreezesDirector = listA return me endSo I ask you, save all the work on your machine, take a new movie and add that script to it. Then enter in the message window:
set gTestObj = new( script 1)then type:
put gTestObjno prob right?
then hold your breath and type
put getProp(gtestobj, getPropAt(gTestObj, 1))Now at this time, I hope you printed out this page cuz this will NOT STOP till the width of sprite starts to approach infinity (lame joke please read on). What amazes me is that attempting to output this results in a pretty damn endless loop but Director allows it to exist and doesn't die a painful death while the variable sits in memory and eeegh, the mind boggles.
Anyway, while daily harping on what Director doesn't do right, it is occasionally baffling to see it survives when it does get put through our collective wringer.
Now back to trying to get rid of those pesky unerasable breakpoints...
Copyright 1997-2024, Director Online. Article content copyright by respective authors.