Articles Archive
Articles Search
Director Wiki
 

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
end

So 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 gTestObj
no 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...

A Director user since 1987, Alex (Zav) Zavatone has worked on the engineering teams for both Director and Shockwave, 4, 5, 6 and 7. Recent investigations find him developing foundation classes for Director with asynchronous process management and other life threatening activities. In its early days, he had something to do with this Internet thing known as "DOUG". A noted ne'erdowell, slacker and laggard, Mr. Zavatone is nonetheless is trusted by children, small animals and the elderly. In his spare time, Mr. Zavatone rehabilitates lame desert trout.

Copyright 1997-2024, Director Online. Article content copyright by respective authors.