On Tuesday, March 23, 2004, at 06:10 AM, [EMAIL PROTECTED] wrote:


From: Doug Lerner <[EMAIL PROTECTED]>
Subject: is within - a syntax bug?
To: How to use Revolution <[EMAIL PROTECTED]>
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset="US-ASCII"

This results in a syntax error that "what is to the left of within" is not a
point:


addToStatus "within: " & the mouseLoc is within the rect of the target
into withinCheck



But rewriting it this way works:


  put the mouseLoc is within the rect of the target into withinCheck
  addToStatus "within: " & withinCheck

A compiler bug?

doug


No, it's not a compiler bug.


Parsing happens left to right, so in your first statement the compiler first evaluated

addStatus "within:" &

and decided there was more to evaluate before it could call addStatus. Then it evaluated

the mouseLoc is within the rect of the target

For explanatory purposes, let's assume the intermediate result of this statement is "true".

then it tried to parse

addStatus "within:true"

and so it called addStatus with "within:true".

And finally it tried to put the result of the addStatus call into the variable withinCheck. But, as addStatus isn't a function the whole thing failed because addStatus didn't return anything.

Anytime you have a complicated expression it's better to use multiple statements (as you saw), or use parentheses to make sure the compiler does things in the order you intend.

Best,
-- Frank

_______________________________________________
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to