Page 8 of 11

Re: FEATURE_INHERITED_PARENTSCRIPTS

Posted: Tue Aug 06, 2013 7:28 pm
by mwieder

Code: Select all

-- context
switch me
  case this me
    break
  case some other me
    break
  case not me
    break
  case knock knock
    answer "who's there?" with banana
    break
end switch

Re: FEATURE_INHERITED_PARENTSCRIPTS

Posted: Wed Aug 07, 2013 12:14 am
by monte
I like how we are gradually implementing multiple personality disorder with behaviors and now this me... Maybe we need a personality property so we can work out the current list of behaviors an object has? ;-)

Re: FEATURE_INHERITED_PARENTSCRIPTS

Posted: Wed Aug 07, 2013 4:57 am
by mwieder
I'd like to propse an ES_BAD_BEHAVIOR return code in parsedefs.h... :-)

Re: FEATURE_INHERITED_PARENTSCRIPTS

Posted: Wed Aug 07, 2013 6:29 am
by monte
Yes and the message should say "That behavior is unnaceptable, go to your room." ;-)

Re: FEATURE_INHERITED_PARENTSCRIPTS

Posted: Wed Aug 07, 2013 9:42 am
by LCMark
:)

On a more serious note, would 'this script' be better? It would help reinforce the idea that behaviors are just scripts and perhaps fit better with contexts where the script of an object is being used rather than the object itself (e.g. frontscripts, backscripts).

Re: FEATURE_INHERITED_PARENTSCRIPTS

Posted: Wed Aug 07, 2013 12:31 pm
by monte
The problem with this script is that the whole point is to get an object reference... That's why I originally suggested scriptObject.

Re: FEATURE_INHERITED_PARENTSCRIPTS

Posted: Wed Aug 07, 2013 12:44 pm
by LCMark
The problem with this script is that the whole point is to get an object reference... That's why I originally suggested scriptObject.
Well, 'this script' would return an object reference - although I guess it might cause confusion as (at first glance) it might look like it returns the script that is executing (as in the text of the script), rather than a reference to the 'script object'. Perhaps 'the scriptObject' would be better - but it just seems a little clunky.

I must confess I did think 'this me' was a serious suggestion - it does actually seem to work quite well cognitively (for me at least - or should that be 'this me' - I'm not sure which behavior I'm running at the moment)... It also adds a little bit of 'quirk' and perhaps humour. Do you think it's worth pulling in 'this me' into 6.1.1 and seeing what people on the lists say? It might shake loose a few suggestions, comments and such if the syntax is actually there and works.

Re: FEATURE_INHERITED_PARENTSCRIPTS

Posted: Wed Aug 07, 2013 1:26 pm
by LCMark
Decided to merge 'this me' into release-6.1.1 so it will be in 6.1.1-rc-2... Let's see what people say :)

Re: FEATURE_INHERITED_PARENTSCRIPTS

Posted: Wed Aug 07, 2013 2:11 pm
by Martin Koob
Regarding 'this me'

As I understand it from the thread 'this me' is supposed to refer to the button that owns the behaviour but without reading the thread I am not sure I would understand it as that. It actually makes me think of the movie Multiplicity. There are several me's which me are we talking about.

I don't know if this is feasible or not but if you wanted to refer to the owner of an object's behaviour could you use a syntax like 'the owner of my behavior''?

my behavior -> would refer to the behavior script of an object

the owner of my behavior -> would return the button containing the behaviour script if it is a behavior, or the object itself if the control does not have a behavior.

Re: FEATURE_INHERITED_PARENTSCRIPTS

Posted: Wed Aug 07, 2013 6:55 pm
by jacque
I have the same reservations as Martin. In all other respects, "me" refers to the script currently executing. I would interpret "this me" to mean the object that triggered the behavior, not the owner of the behavior. "Owner" is more in line with how I'd interpret things. Or maybe we could use "this control" and avoid the word "me" entirely:

put the long name of this control

I chose "control" rather than "button" in case eventually we can assign behavior scripts to any object. But to be consistent, "this button" should probably resolve correctly too.

I'm not married to this suggestion, but I'm pretty sure "this me" is going to cause confusion because "me" always means the object running the script, and making a single exception for it will throw a lot of people.

Re: FEATURE_INHERITED_PARENTSCRIPTS

Posted: Wed Aug 07, 2013 7:52 pm
by trevordevore
Martin Koob wrote:the owner of my behavior -> would return the button containing the behaviour script if it is a behavior, or the object itself if the control does not have a behavior.
I don't think 'the owner of my behavior' makes sense given the property we are trying to access. Here is why - the purpose of 'this me' is to get a reference to the actual object containing the script that is executing from within that script itself. 'the owner of my behavior' implies the following:

A) You have a control with a behavior assigned to it.
B) You want the owner of the behavior assigned to the control.

I read this as a property you would use from the script that has a behavior assigned to it, rather than within the behavior script itself.

Perhaps another recap of how the property would be used will be useful. Image this scenario - I am distributing a stack that contains all of the behavior for my custom control as well as some supporting behaviors and/or controls that my custom control will need access to while being used. Given the new chained behavior feature a developer might use my custom control in the following way. Tthis is an actual scenario I am using in a project, not theoretical.

Custom Control (a group) [Control 1]
'Developers Extension of Custom Control' button [Control 2] is assigned as a behavior to 'Control 1'. (A behavior implementing some additional behavior developer wants to add.)
'Actual Custom Control Behavior' button [Control 3] is assigned as a behavior to 'Control 2'. (Behavior containing actual custom control implementation.)

When the 'Actual Custom Control Behavior' script is executing 'this me' returns a reference to 'Control 3', while 'me' returns a reference to 'Control 1'. As a custom control developer I can then use the 'this me' reference to determine the card that 'Control 3' is on and reference any other controls or buttons my custom control needs that reside on that card.

Note that there is not (currently) a way to determine the existence of 'Control 2' while executing the script of 'Control 3'. This doesn't bother me as I don't have a scenario where you would need to know that.

Now, I am not arguing that 'this me' is the best syntax. I'm merely pointing out why I don't think 'the owner of my behavior' (or something similar) doesn't make sense to me given the purpose of the property.

Re: FEATURE_INHERITED_PARENTSCRIPTS

Posted: Wed Aug 07, 2013 9:50 pm
by mwieder
@trevor- good points, but
I read this as a property you would use from the script that has a behavior assigned to it, rather than within the behavior script itself.
I've been thinking that the <whatever> property would be used from within the behavior script.
Maybe there are two different situations in which we need to identify the parent object?

Re: FEATURE_INHERITED_PARENTSCRIPTS

Posted: Wed Aug 07, 2013 10:24 pm
by Martin Koob
Thanks Trevor for the explanation. Still trying to get my head around linked behaviors and it feels like "Who's on first? I don't know. Third base!" Your example helps to clarify it.

How about this? Me refers to the control's context. Mine would refer to the context of the behavior.

on mouseUp
--return control's context
put the short name of the owner of me into tControlCard --get the card the control is on
put the cLevel of me into tThisProperty --get the property of the control

--return behavior's context
put the short name of the owner of mine into tBehaviorCard --get the card the behavior is on
put the cLevel of mine into tBehaviorProperty --get the property of the behavior
end mouseUp

There would still be a need to explain to users the difference between 'me' and 'mine' but the sentences with 'of mine' are more english like than 'of this me'

Re: FEATURE_INHERITED_PARENTSCRIPTS

Posted: Thu Aug 08, 2013 3:45 am
by monte
Re-reading the thread and the different options that have been proposed I think I like this behavior the most. It doesn't work outside the behavior script context but then again it probably doesn't need to. I just realised that the scriptObject could get confusing if we ever get OOP...

Re: FEATURE_INHERITED_PARENTSCRIPTS

Posted: Thu Aug 08, 2013 5:34 am
by mwieder
Jim Lambert proposed "the effective me",

but how about "myself"?