I've run into a snag here with the modified stack manager code that Irv
proposed a few days ago.  

As follows is my script for a type agnostic object stack manager.  The
problem lies in the fact that I need to say stack[somestackpoint] is
equal to a new object of type typeofstack and name objectofstack.  I am
at a loss as to how to properly represent this without using do.

For instance, lets say typeofstack = "xtra" and objectofstack =
"xmlparser", I need do to execute "new (xtra "xmlparser")".
Theoretically that is what my do cmd below is doing.  However, I keep
receiving "variable not defined" errors with the question mark after the
"new(" string.  Is what I'm doing legal?   If not, any proposed
suggestions on how I would go about doing it correctly?


property stack
property typeofstack
property objectofstack
property maxsizeofstack

on new me, stacktype, stackobject, maxsize
  me.maxsizeofstack = maxsize
  me.stack = []
  me.typeofstack = stacktype
  me.objectofstack = stackobject
  return me
end 

on addnewstackobject 
  if (stack.count < maxsizeofstack) then
    stack.append((do "new(" & typeofstack & " " & QUOTE &
string(objectofstack) & QUOTE & ")"))           return stack.count
  else
    if ((findrecycledstackobject()) <> void) then
      return findrecycledstackobject()
    end if
  end if
  return void
end addnewstackobject


on findrecycledstackobject
  repeat with control = 1 to stack.count
    if (stack[control] = 0) then
      stack[control] = 0
      return stack[control]
    end if
  end repeat
  return void
end findrecycledstackobject


~matt desimone
[EMAIL PROTECTED]
www.syrupnyc.com



[To remove yourself from this list, or to change to digest mode, go to 
http://www.penworks.com/lingo-l.cgi  To post messages to the list, email 
[EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED]). Lingo-L is for 
learning and helping with programming Lingo.  Thanks!]

Reply via email to