Page 7 of 11
Re: FEATURE_INHERITED_PARENTSCRIPTS
Posted: Mon Jun 03, 2013 7:09 pm
by mwieder
OK - I did a bit more experimenting and it's trickier than I thought. I hadn't thought of sending or calling directly into behavior scripts before rather than just inheriting the scripts. I confess I can't think of a problem that this solves, though. Now I'm coming around to Dar's request for a "caller" property that would unambiguously return a reference to the object that originated the request, whether it's a send/dispatch, call, or direct or inherited command invocation.
...and we still need an object syntax for the object the script is running in.
Re: FEATURE_INHERITED_PARENTSCRIPTS
Posted: Tue Jun 04, 2013 8:34 am
by LCMark
OK - I did a bit more experimenting and it's trickier than I thought. I hadn't thought of sending or calling directly into behavior scripts before rather than just inheriting the scripts. I confess I can't think of a problem that this solves, though. Now I'm coming around to Dar's request for a "caller" property that would unambiguously return a reference to the object that originated the request, whether it's a send/dispatch, call, or direct or inherited command invocation.
There's no need to send or call directly into a behavior script to see the different...
Code: Select all
group 1 -> behavior 1
button 1
button 2
Let's say behavior 1 defines a handler 'foobar', then doing in button 1:
Will result in foobar being (eventually) invoked in group 1 with 'the target' button 1, and 'me' group 1.
Re: FEATURE_INHERITED_PARENTSCRIPTS
Posted: Tue Jun 04, 2013 5:29 pm
by mwieder
Good point. I forgot about group behaviors in this context.
...although "me" referencing a different object than the actual object containing the script sounds a bit like something out of Monty Python...
Re: FEATURE_INHERITED_PARENTSCRIPTS
Posted: Mon Jul 29, 2013 11:15 pm
by trevordevore
I'm wondering if any more thought has been put into 'the scriptObject' idea discussed in this thread. I have a custom control that has some supporting controls on the same card as the behavior button. In order to use these supporting controls I need to get a reference to the behavior button. Having a reference (like 'the scriptObject') would be an elegant way to achieve this. Parsing the executionContexts is, well, less elegant.
Re: FEATURE_INHERITED_PARENTSCRIPTS
Posted: Tue Jul 30, 2013 12:08 am
by monte
Well... we had a chat about syntax then lost the plot. I still like 'this behavior'... BTW recursively parsing the behavior property might be an option too.
Re: FEATURE_INHERITED_PARENTSCRIPTS
Posted: Tue Jul 30, 2013 12:39 am
by trevordevore
BTW recursively parsing the behavior property might be an option too.
True. This would require some hard coding of names, however, wouldn't it? Since you have no way of knowing which behavior is the custom controls then you would have to check the name of each behavior control.
I still like 'this behavior'
What about 'this me'?

Re: FEATURE_INHERITED_PARENTSCRIPTS
Posted: Tue Jul 30, 2013 12:56 am
by monte
True. This would require some hard coding of names, however, wouldn't it? Since you have no way of knowing which behavior is the custom controls then you would have to check the name of each behavior control.
I was thinking you would need to tag your behavior object in some way so you could identify it. Either a custom property value or just the name:
Code: Select all
put findBehavior(the behavior of me,"com.bluemango.widget") into theScriptObject
Code: Select all
function findBehavior pObject,pClass
if the short name of pObject is pClass or pObject is empty then return pObject
return findBehavior(the behavior of pObject,pClass)
end
What about 'this me'?
I'm sold

Re: FEATURE_INHERITED_PARENTSCRIPTS
Posted: Tue Jul 30, 2013 12:59 am
by trevordevore
Ah, that method will work well enough until we get some sort of better reference.
Re: FEATURE_INHERITED_PARENTSCRIPTS
Posted: Wed Jul 31, 2013 12:04 pm
by LCMark
Well... we had a chat about syntax then lost the plot. I still like 'this behavior'... BTW recursively parsing the behavior property might be an option too.
I think it was a case of - we might need this at some point, but since we couldn't decide on firm syntax it was left hanging.
It's easy to add - if we can decide on syntax

Re: FEATURE_INHERITED_PARENTSCRIPTS
Posted: Thu Aug 01, 2013 1:07 am
by monte
We're settled on 'this me'

Re: FEATURE_INHERITED_PARENTSCRIPTS
Posted: Mon Aug 05, 2013 11:30 am
by LCMark
Seems as good as anything else that's been suggested so far - implemented and should be fine to go into 6.1.1 (feature-this_me branch in runrevmark).
Re: FEATURE_INHERITED_PARENTSCRIPTS
Posted: Mon Aug 05, 2013 11:39 am
by monte
Lol... Serves us right for joking around Trevor

Re: FEATURE_INHERITED_PARENTSCRIPTS
Posted: Mon Aug 05, 2013 12:12 pm
by LCMark
Lol... Serves us right for joking around Trevor

It's easy enough to change to 'this behavior' (or even 'this script'?) - it just means changing the 'skip_token()' line. I guess we can just wait and see what the reaction is to 'this me', and see if anybody comes up with a better suggestion

Re: FEATURE_INHERITED_PARENTSCRIPTS
Posted: Mon Aug 05, 2013 6:28 pm
by jacque
HyperCard had a script error that said, "Script too silly to parse."
I kind of get that same reaction with "this me". Maybe it would make more sense in context.

Re: FEATURE_INHERITED_PARENTSCRIPTS
Posted: Tue Aug 06, 2013 7:24 pm
by mwieder
You want context?
If you google "this me" it suggests "this means war".