x( 666) -> No error!

If you find an issue in LiveCode but are having difficulty pinning down a reliable recipe or want to sanity-check your findings with others, this is the place.

Please have one thread per issue, and try to summarize the issue concisely in the thread title so others can find related issues here.

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
Thierry
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 794
Joined: Wed Nov 22, 2006 3:42 pm
Location: France
Contact:

x( 666) -> No error!

Post by Thierry » Tue May 26, 2020 10:29 am

Hi,

Not sure if this is a known bug,
but this costs me a lot of time to find out the problem :evil:


sunnYscrrenshot 2020-05-26 à 11.23.27.png

Best,

Thierry
Regex LiveCode sunnYrex
https://sunny-tdz.com

bogs
Posts: 4791
Joined: Sat Feb 25, 2017 10:45 pm

Re: x( 666) -> No error!

Post by bogs » Tue May 26, 2020 10:34 am

I'm sure I am missing something incredibly blatant Thierry, but it looks like your passing a function with a value, then without, why would that generate an error (assuming the function allows for no value)?
Image

Thierry
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 794
Joined: Wed Nov 22, 2006 3:42 pm
Location: France
Contact:

Re: x( 666) -> No error!

Post by Thierry » Tue May 26, 2020 10:46 am

bogs wrote:
Tue May 26, 2020 10:34 am
I'm sure I am missing something incredibly blatant Thierry, ...
bogs,
both lines are wrong; they should be:

Code: Select all

get x()
get x(666)
Just type these 2 lines in the SE, save the script, and see...

Oh, I'm with LC9.6, but now I remember having seen that already in the past.

and for this simple scenario the function x was not defined,
but that's not the point here.

Regards,

Thierry
Regex LiveCode sunnYrex
https://sunny-tdz.com

bogs
Posts: 4791
Joined: Sat Feb 25, 2017 10:45 pm

Re: x( 666) -> No error!

Post by bogs » Tue May 26, 2020 10:56 am

It is early for me, if there is no function x then it probably should throw a message, but I didn't think you needed 'get' to do something with a function or command. I wonder if that explains some things I see happen in my own code haha.
Image

LCMark
Livecode Staff Member
Livecode Staff Member
Posts: 1095
Joined: Thu Apr 11, 2013 11:27 am

Re: x( 666) -> No error!

Post by LCMark » Tue May 26, 2020 11:00 am

This isn't a bug really just a side-effect of command call syntax which is:

Code: Select all

IDENTIFIER EXPR , ... , EXPR
As an expression can be (EXPR), and the ( token doesn't need whitespace before it you have that:

Code: Select all

x(666)
Means call x with argument 666 and

Code: Select all

x()
Is a parse error as () is not a valid expression.

EDIT: If the syntax error (second case) wasn't there you would get an error at runtime for the first case assuming there is a function handler in the message path of the button with name x.

Thierry
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 794
Joined: Wed Nov 22, 2006 3:42 pm
Location: France
Contact:

Re: x( 666) -> No error!

Post by Thierry » Tue May 26, 2020 11:18 am

LCMark wrote:
Tue May 26, 2020 11:00 am
This isn't a bug really just a side-effect of command call syntax
Thanks Mark for your quick answer.

Regards,

Thierry
Regex LiveCode sunnYrex
https://sunny-tdz.com

Post Reply

Return to “Bug Triage”