Jump to content


Photo

Return typo not producing a parser error


  • Please log in to reply
6 replies to this topic

#1 alaricljs

alaricljs
  • Members
  • 17 posts

Posted 20 August 2012 - 05:24 AM

Don't know if this is something you aim at covering, however I am using AutoHotKey_L v1.1.08.01 Unicode 64bit and the following produces interesting results, and no parse error:

MyLabel:
Return:

The above produces the result of Exit rather than a Return and does not generate any parse errors. Return : does produce a parse error. I found this a little strange.

#2 joedf

joedf
  • Members
  • 345 posts

Posted 20 August 2012 - 06:37 AM

U made a label called return and there's no actual return meaning that it exit because there's no hotkey or GUI or loop

#3 engunneer

engunneer
  • Fellows
  • 9162 posts

Posted 20 August 2012 - 12:51 PM

an interesting side effect of the language design is that there aren't many reserved words. This allows things like:
Loop := 500
SetTimer, Loop, %Loop%
Loop
Loop, %Loop%
Loop = %Loop%
Loop:
Tooltip, %Loop%, %Loop%, %Loop%


#4 joedf

joedf
  • Members
  • 345 posts

Posted 20 August 2012 - 07:32 PM

It's pretty cool but it can get very confusing :S

#5 engunneer

engunneer
  • Fellows
  • 9162 posts

Posted 22 August 2012 - 12:09 PM

that's my point. languages like BASIC reserve words so you can't use them. AHK mostly doesn't (It might reserve a few, but I'm not thinking of any at the moment). Therefore, it can be confusing, especially if you cross the words to mean something else. Occasionally I want Pre-processor macros (#define) but that would only make more things confusing

#6 alaricljs

alaricljs
  • Members
  • 17 posts

Posted 22 August 2012 - 07:18 PM

Since it was a typo it took quite a while to track down. There's +/- to any design decision but I learn AHK as I go along, so some of the language definition gets ignored while I aim for the functional parts to get my work done. The layout of the docs also doesn't make it easy (from my point of view) to find out that return isn't reserved.

#7 Guests

  • Guests

Posted 22 August 2012 - 09:41 PM

... I learn AHK as I go along

Since 2005 :!: :D