propertyChanged?

Mark Waddingham mark at livecode.com
Mon Jun 12 14:49:02 EDT 2017


On 2017-06-12 20:42, Mark Waddingham via use-livecode wrote:
> I'm not sure how long it might be before it becomes a fully supported,
> end-user feature (there's a great publish/subscribe model lurking
> there somewhere - at least tuned to an IDE-like applications needs -
> see further down) but we could evaluate moving the existing mechanism
> from IDE engine to all engines. The way it is implemented means that
> it has minimal performance impact if not used I believe (although I'd
> want to verify that).

Just answering myself...

I actually moved the revAvailableHandlers feature from IDE engine to all 
engines this morning - there was no reason to have it only in the IDE 
engine, although the same 'it might change' rules apply to it as always 
did. In this case, it made it easier to write unit tests for it - after 
I added introspection on chained behaviors to it - Ali's recently 
excellent work on getting the message box's 'intelligence' to work more 
robustly relies on this to work out if something is a command or 
function in the message path... The lack of behavior handlers in it made 
the message box slightly wonky in a prerelease build of 8.1.5-rc-1.

So, that will be available in standalones for anyone who might need such 
a thing - although don't get irked if its format or usage changes in 
some future engine versions :)

For those who haven't ever poked around in the IDE internals (which is 
probably most people!) the 'revAvailableHandlers' is a property of all 
objects which returns the list of handlers (with type) in a string 
present in the script of that specific object. Then the 'the effective 
revAvailableHandlers' returns a similar list, but for all handlers which 
are accessible from it in the message path (e.g. including frontscripts, 
backscripts, library stacks, and behaviors at all points).

If you want to see what it tells you then try in the message box:

   put the effective revAvailableHandlers of me

(Note it only works for scripts which compile - it doesn't attempt to do 
anything with scripts with compile errors as it uses the internal 
abstract syntax tree (AST) the engine constructs to get the information, 
and if a script doesn't compile, there is no AST to look at).

Warmest Regards,

Mark.

-- 
Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps





More information about the use-livecode mailing list