Script Only Stacks and Script Locals

Monte Goulding monte at appisle.net
Fri Jul 15 23:52:17 EDT 2016


> On 16 Jul 2016, at 1:35 PM, J. Landman Gay <jacque at hyperactivesw.com> wrote:
> 
>>> function getSMediaItemData
>>>   return sMediaItemData
>>> end getSMediaItemData
>> 
>> gmta
> 
> Yeah, and Monte too. Parallel evolution.

I think it makes the most sense when any of the following are true:
 - only want read only access
 - want to sanitise the value on set or take some other action
 - want to be able to change data storage without impacting any reliant code

It should be noted that getProp and setProp handlers might seem ideal for this but they aren’t sent when lockmessages is true which generally means code that needs to be robust to that (code running in an unknown or complex environment) can’t use them at all. One of my concerns is that there is significant use of them in the IDE so that will need to get sorted at some point.

For reference:
http://quality.livecode.com/show_bug.cgi?id=226 <http://quality.livecode.com/show_bug.cgi?id=226>

I suspect this should be upgraded to an ANOMALY report meaning something we hope to one day work out how to resolve in a backwards compatible way.

One way would perhaps be to declare a virtual property and declared properties would always call setProp and getProp and never set the custom property itself (depending on the script to do that if necessary):

property myProp
local sProp

setProp myProp pVal
   put pVal into sProp
end myProp

getProp myProp
   return sProp
end myProp

Cheers

Monte


More information about the use-livecode mailing list