Page 1 of 1

x( 666) -> No error!

Posted: Tue May 26, 2020 10:29 am
by Thierry
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

Re: x( 666) -> No error!

Posted: Tue May 26, 2020 10:34 am
by bogs
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)?

Re: x( 666) -> No error!

Posted: Tue May 26, 2020 10:46 am
by Thierry
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

Re: x( 666) -> No error!

Posted: Tue May 26, 2020 10:56 am
by bogs
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.

Re: x( 666) -> No error!

Posted: Tue May 26, 2020 11:00 am
by LCMark
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.

Re: x( 666) -> No error!

Posted: Tue May 26, 2020 11:18 am
by Thierry
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