[Not a bug]Error evaluating expression. There may be a ..

Report problems with documented functionality
User avatar
RobertL
Posts: 546
Joined: 18 Jan 2014, 01:14
Location: China

[Not a bug]Error evaluating expression. There may be a ..

17 Sep 2014, 19:13

Code: Select all

;AHK V2 a-0.48+
_:=new()	;Error:  Error evaluating expression.  There may be a syntax error.
I though it means there is an error which dont sure why (may be a syntax error), if you find it, report it.
There's no result of search on 'Error evaluating expression. There may be a syntax error.', so made this one.
I know new is an reserved operator. Just my accidental error.
So, if useless, please ignore this.
我为人人,人人为己?
lexikos
Posts: 9592
Joined: 30 Sep 2013, 04:07
Contact:

Re: [Not a bug]Error evaluating expression. There may be a

17 Sep 2014, 20:29

If it meant for you to report it, it would say "Please report it."

The error message is vague because it didn't detect a specific syntax error; it detected a runtime condition which is generally always indirectly caused by a syntax error.
User avatar
RobertL
Posts: 546
Joined: 18 Jan 2014, 01:14
Location: China

Re: [Not a bug]Error evaluating expression. There may be a

17 Sep 2014, 20:34

OK~Thanks.
我为人人,人人为己?
lexikos
Posts: 9592
Joined: 30 Sep 2013, 04:07
Contact:

Re: [Not a bug]Error evaluating expression. There may be a

17 Sep 2014, 21:35

Also note that this condition isn't detected immediately, so strange things can happen, such as an unexpected value being used as input:

Code: Select all

try (x + C := new ())
MsgBox % IsObject(x)
class C {
	__New() {
		MsgBox C.__New
	}
}
This is because expressions are "pre-compiled" to postfix form, like:

Code: Select all

push x
push C
; ... missing push class_object_for_new ...
call new, 1 input   ; consumes C as input (unintended)
assign   ; intended input: C, (result of new); actual input: x, (result of new)
add   ; intended input: x, C; actual input: C, <insufficient inputs>
User avatar
RobertL
Posts: 546
Joined: 18 Jan 2014, 01:14
Location: China

Re: [Not a bug]Error evaluating expression. There may be a

17 Sep 2014, 21:51

I see, operand (bottom to top) x-c-missing_class_object_for_new, then operator new, pop top operandc..
If change all operator to function, then easy to take which is uniformity but not convenient.
Thanks to point out.

BTW, I didn't reappear any error with your demo in AHK V1.1.16, just show '0' by first Msgbox, with or without try.
我为人人,人人为己?
lexikos
Posts: 9592
Joined: 30 Sep 2013, 04:07
Contact:

Re: [Not a bug]Error evaluating expression. There may be a

17 Sep 2014, 22:21

The error didn't "reappear", but it was there. The difference is that in v1, new is only treated as an operator if followed by a variable name. So it's like this case (you can replace _new_ with new in v1):

Code: Select all

C := 4
_new_ := 2
try (x + C := _new_ ())
MsgBox % x=42
User avatar
RobertL
Posts: 546
Joined: 18 Jan 2014, 01:14
Location: China

Re: [Not a bug]Error evaluating expression. There may be a

17 Sep 2014, 23:00

Haha, interesting, but didnt find a way to use this 'feature',..joking.

一些中文/Chinese记录:new运算符
我为人人,人人为己?

Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 50 guests