Virtual Custom Property Sample - Recursion Limit Problem

Bernard Devlin revolution at knowledgeworks.plus.com
Fri Jan 12 09:14:18 EST 2007


I am looking into virtual custom properties (specifically: using them  
to provide default values if a custom property of an object is empty  
or does not exist).  My understanding is that a getProp message  
should percolate up the message path, and when it finds a getProp  
handler it should be able to use whatever value is returned.

This sample from the Dictionary looks like what I am trying to do  
should be reasonable:

 >>
  getProp expertSettings[thePropertyName]
     -- The thePropertyName parameter contains the name of
     -- the property that's being set
     switch thePropertyName
     case "fileMenuContents"
       if the expertSettings[fileMenuContents] of the target \
          is empty then return "(No items"
       else pass expertSettings
       break
     case "editMenuContents"
       if the expertSettings[editMenuContents] of the target \
          is empty then return \
          the noviceSettings[editMenuContents] of the target
       else pass expertSettings
       break
     default
       pass expertSettings
     end switch
   end expertSettings

<<

It seems to work fine when I put this in the MB:

      get the expertSettings["fileMenuContents"] of this stack

However, if I type this instead:

      get the expertSettings["fileMenuContents"] of this card

Then I get this error:

      Message execution error:
      Error description: recursionLimit: Recursion limit reached

The stack I'm testing this in is a new stack with no controls on it  
(just the default card of any new stack).

Is the documentation wrong, or is it my understanding of it that is  
mistaken?

Bernard

P.S. The recursionLimit is at the default of 400000.  Incidentally,  
the TD says this should be 1000000 by default.  Since it is global  
property, I'm assuming that even if I changed it to 400000 in the  
past, it should be resetting itself to 1000000 on restart.  Is that  
right?




More information about the use-livecode mailing list