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

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: Klaus, FourthWorld, heatherlaine, robinmiller, kevinmiller

Post Reply
Simon Knight
Posts: 470
Joined: Wed Nov 04, 2009 11:41 am
Location: Gunthorpe, North Lincs, UK

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

Post by Simon Knight » Mon May 27, 2019 1:09 pm

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?
best wishes
Skids

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2351
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

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

Post by jmburnod » Mon May 27, 2019 1:31 pm

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

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2787
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

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

Post by mwieder » Tue May 28, 2019 2:12 am

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.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6720
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

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

Post by FourthWorld » Tue May 28, 2019 4:37 am

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
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2787
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

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

Post by mwieder » Tue May 28, 2019 4:49 am

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.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6720
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

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

Post by FourthWorld » Tue May 28, 2019 5:46 am

Agreed, but I wouldn't be surprised if someone later complained, "But that used to not throw an error, so this is a regression!" :)
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

Simon Knight
Posts: 470
Joined: Wed Nov 04, 2009 11:41 am
Location: Gunthorpe, North Lincs, UK

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

Post by Simon Knight » Tue May 28, 2019 7:59 am

Thanks for your replies. I have raised a bug report Bug 22104 : https://quality.livecode.com/show_bug.cgi?id=22104
best wishes
Skids

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2787
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

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

Post by mwieder » Tue May 28, 2019 6:01 pm

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

Post Reply

Return to “Talking LiveCode”