Page 1 of 1

Using "of me" fails to throw an error - is this expected?

Posted: Mon May 27, 2019 1:09 pm
by Simon Knight
I copied a line of script from a card into a button. The script referred to a group on the card and could/should not work in the button:

Code: Select all

answer "Location is now :" & the loc of group "viewergroup" of me
When run in the card it returns the location of the group. However, when run from a button on the card it returns the location of the button.

Is this a bug? I would have thought that a "unable to find background" type error should of been raised.

Any thoughts?

Re: Using "of me" fails to throw an error - is this expected?

Posted: Mon May 27, 2019 1:31 pm
by jmburnod
Hi Simon,
When you use the cd script me = "cd id...."
When you use a btn script the name of me = button "Button"
It seems LiveCode ignore that we can't have a group inside a button and return by default the loc of the btn
Best regards
Jean-Marc

Re: Using "of me" fails to throw an error - is this expected?

Posted: Tue May 28, 2019 2:12 am
by mwieder
Yep - that's definitely buggy behavior and worthy of a bug report.
And it works that way in 9.5dp1 as well, so it's a good time to fix it.

Re: Using "of me" fails to throw an error - is this expected?

Posted: Tue May 28, 2019 4:37 am
by FourthWorld
In a similar discussion on the mail list, Mark Waddingham recently provided some background on the "lax" parsing in the engine:

http://lists.runrev.com/pipermail/use-l ... 54425.html

Re: Using "of me" fails to throw an error - is this expected?

Posted: Tue May 28, 2019 4:49 am
by mwieder
Yes, but... in that case it's lax parsing that has been tightened up in a recent (9.5dp1) build.

Here "of me" is benign but misleading: there may be other instances of "of me" in that script that correctly refer to the button object, and having a different "of me" line refer to the containing object instead may or may not give the desired result.

So I'd still argue that it's a bug that should be fixed and the parser tightened up.

Re: Using "of me" fails to throw an error - is this expected?

Posted: Tue May 28, 2019 5:46 am
by FourthWorld
Agreed, but I wouldn't be surprised if someone later complained, "But that used to not throw an error, so this is a regression!" :)

Re: Using "of me" fails to throw an error - is this expected?

Posted: Tue May 28, 2019 7:59 am
by Simon Knight
Thanks for your replies. I have raised a bug report Bug 22104 : https://quality.livecode.com/show_bug.cgi?id=22104

Re: Using "of me" fails to throw an error - is this expected?

Posted: Tue May 28, 2019 6:01 pm
by mwieder
Simon - thanks.
Richard - yep. But at least there's an easy workaround for that.

In general I'm all in for fixing things that should be bugs but aren't.

...sheesh... taken out of context, that sentence is completely wacky. :P