Mark Wieder wrote:
I do use getter and setter routines regularly. I think your function is useful, but won't by itself get at the question of "who changed that?", and for that question there are at least two possible methods:

method 1:

local sCurrentFlavorA

command setCurrentFruitFlavorTo pFlavor
   put pFlavor into sCurrentFlavor["fruit"]
end setCurrentFruitFlavorTo

setCurrentFruitFlavorTo "orange"

method 2:

setProp CurrentFruitFlavor pFlavor
   put pFlavor into sCurrentFlavor["fruit"]
end CurrentFruitFlavor

getProp CurrentFruitFlavor
   return sCurrentFlavor["fruit"]
end CurrentFruitFlavor

set the CurrentFruitFlavor of me to "orange"
get the CurrentFruitFlavor of me

With rare exceptions I use Method 1 almost exclusively.

Method 2 feel more natural in many respects, but suffers from one drawback critical in some cases: when lockMessages is true getProp and setProp won't fire.

Custom handlers will always fire regardless of the current state of message locking.

This has been discussed before, and IIRC Mark Waddingham expressed an interest in perhaps reclassifying getProp and setProp from system messages to custom messages, so they would become as immune to locking as other custom handlers. But despite the good intention, it seems the work involved would have murky non-trivial implications.

So for the sake of robustness (and sanity during debugging when things go mysteriously wrong), as much as I would prefer to use property syntax for things that behave like properties, I don't.

 Richard Gaskin
 Fourth World Systems
 Software Design and Development for the Desktop, Mobile, and the Web

use-livecode mailing list
Please visit this url to subscribe, unsubscribe and manage your subscription 

Reply via email to