Clean Up Code
I find it very hard to code in AutoHotKey.... You don't know whether to use if with commas or () or if, then, or if {}... I think if you standardize your code some, it'd be much easier to write code in AHK...
I personaly like it being a c programmer.
Jason
Is this what you are talking about?Thanks. The requirement for parentheses around an if-statement's condition will probably be removed in v2.
If var = 1 OR var = 10 ; Instead of If (var = 1 OR var = 10) ; ?
Yes, if the string is not purely numeric it requires double quotes. This is because the parenthesis sets the If statement to an expression.isn't it like if you have parenthesis, you have to put "" around strings? The examples in the help files were very inconsistant and not thoroughly defined....
Read the posts of this link it should help you understand.
http://www.autohotke...pic.php?t=13651
Thanks. The requirement for parentheses around an if-statement's condition will probably be removed in v2.
OMG. I'd rather have it forced to have parentheses around the condition. Its just more readable. Now if you make it optional this could again irritate newbies. I know you want not to break compatibility, but seriously that could be fixed easy in existing ahk scripts. In my humble opinion backwardcompatibility should be discarded at all for v2 since ahk scripts aren't rocketscience and can be fixed easily to suit the new syntax.
There are many more things i don't like in ahk syntax, like escaping " in strings with another ". Generally speaking that characters in special cases cant be escaped with the escape char is ambiguous.
Because you are used to it, but since no instruction can follow the If on the same line, they are just unecessary. And as long as they are legal, you can stick to the policy to always put them. Of course, you will read lot of script omitting them...OMG. I'd rather have it forced to have parentheses around the condition. Its just more readable.
Well, this syntax comes from Basic (VB?), IIRC. But indeed, the lack of consistency with backquote escape is annoying.There are many more things i don't like in ahk syntax, like escaping " in strings with another ". Generally speaking that characters in special cases cant be escaped with the escape char is ambiguous.
Designing a language is difficult... :-)
Many people want to break compatibility and make major overhauls to the language. But if Chris wanted to have a C-like language, he would have just sticked to AutoIt3...
I rekon that double syntax (a = b vs. a := "b" / If a = b vs. If (a = "b")), coming from the welcome introduction of the expressions in the language, while keeping the old syntax for compatibility and simplicity is a major source of trouble for newbies.
But it seems that lot of people would protest if they are forced to enclose their strings between quotes...
So why not just leave it how it currently is? In my opinion, I think it is setup good, and easy to follow.But it seems that lot of people would protest if they are forced to enclose their strings between quotes...
What your saying is that instead of...There are many more things i don't like in ahk syntax, like escaping " in strings with another ". Generally speaking that characters in special cases cant be escaped with the escape char is ambiguous.
var := "this string has a "" double quote."
Have it like this...
var := "this string has a `" double quote."
?
I think thats a good idea, although it would break existing scripts, so probably best for v2.
You would still use parentheses if you wish. In other words, both of the following would be okay in v2:will be removed or not required.
if x = 5 and y = 6 ; Only allowed in #v2. if (x = 5 and y = 6) ; Allowed in either v1 or v2.
The bottom line is the following info from the expressions section: An if-statement that contains an expression is differentiated from a traditional if-statement such as If FoundColor <> Blue by making the character after the word "if" an open-parenthesis. Although this is usually accomplished by enclosing the entire expression in parentheses, it can also be done with something like if (x > 0) and (y > 0). In addition, the open-parenthesis may be omitted entirely if the first item after the word "if" is a function call or an operator such as "not" or "!".isn't it like if you have parenthesis, you have to put "" around strings? The examples in the help files were very inconsistant and not thoroughly defined....
In any case, this confusion will all be gone for scripts that opt to use the #v2 directive because there won't be any such thing as traditional IF-statements anymore; they'll all be expressions.
That's exactly the reason for having v2: to improve the language at the expense of sacrificing some backward compatibility. There will probably be a conversion utility that makes it easy to upgrade old scripts to the new syntax (the new syntax won't be much different anyway).backwardcompatibility should be discarded at all for v2 since ahk scripts aren't rocketscience and can be fixed easily to suit the new syntax.
I'll take a look at allowing `" to stand for a quote in v2. Thanks for the idea.There are many more things i don't like in ahk syntax, like escaping " in strings with another ". Generally speaking that characters in special cases cant be escaped with the escape char is ambiguous.
Having two types of IF-statements and two types of assignments (= and :=) are probably the biggest source of confusion and bugs in scripts (other than misspelled variable names). So getting rid of the old versions seems like the lesser of two evils.But it seems that lot of people would protest if they are forced to enclose their strings between quotes...
Thanks for the ideas.
I doubt that the majority prefers to omit the parentheses. But thats just my opinion and since it will be treated as expression anyway i wont argue about it anymore since it will be only a matter of gusto and you can't argue about that.Because you are used to it, but since no instruction can follow the If on the same line, they are just unecessary. And as long as they are legal, you can stick to the policy to always put them. Of course, you will read lot of script omitting them...OMG. I'd rather have it forced to have parentheses around the condition. Its just more readable.
However the inconsistentcy in the syntax of ahk is errorprone for ahknewbies. And i have this info from an fellow who i told about ahk a few days ago. I wanted to enthuse him about ahk and started to introduce him to variable assignment first but very soon i realised how confusing this, for a ahknewbie like him, is.
Will the assignment-operator be = with the functionality of :=?Having two types of IF-statements and two types of assignments (= and :=) are probably the biggest source of confusion and bugs in scripts (other than misspelled variable names). So getting rid of the old versions seems like the lesser of two evils.
That's the current plan.Will the assignment-operator be = with the functionality of :=?
...I'm not sure "having" both is confusing but the docs are confusing ("documenting" both)...when you added expressions you added some "side-notes" talking about the new expression syntax, leaving the examples mostly unmodified or one example shows one way (the old way) & another shows the new way, without clearly explaining all the differences...or telling the new user which they should focus on learning...users like me pick which way they wanna do it, but some newbies can't decide & just get confused when 2 different ways exist...or are mentioned in the docs...for example...IfEqual syntax is an old left-over pile of dung (sorry) from AutoIt 2...I've never used it cuz when I joined AHK you already had non-expression if...the docs on if say...Having two types of IF-statements and two types of assignments (= and :=) are probably the biggest source of confusion... So getting rid of the old versions seems like the lesser of two evils.
IfEqual, var, value (same: if var = value)...while this is compact, it's not very clear (not to mention the title of that page is confusing)...adding "same:" doesn't explain why both work or anything about it...people might decide to use IfEqual cuz it's listed 1st or looks like the more suggested way to code...(since normal if syntax is just a sidebar in parens)...then they come to the forum & see good code & it fries their brain...seeing if with & without parens...mixing the 2 & getting that "dynamic variable is blank" message (nice helpful message, but not for a newbie that was just trying to "if" & don't know what a "dynamic variable" is {hehe...perhaps you should revise that error message..."dynamic variable is blank...or you fscked up your expression-if...REMOVE THE PERCENT SIGNS %var% -> var..."})...I'm not really dogging on you or the docs...just compiling the confusion I've seen newbies express...I understand all of AHK (I think) but I just am that way with comps...I sit down for 5 mins with a new prog & I know how it works. I really wanna try to redo the docs someday, but I don't know if I wanna start with a blank page & add my thoughts or start editing & reformatting the existing docs...I'm certainly getting rid of that yellow bar...if favor of some other color...BTW...is there any reason the docs all end with .htm & not .html?
...YIKES!...expressions & continuation sections are enemies...when I needed to write a replacement msgbox function I had to settle on this calling convention to turn off expressions for the function call...I would like most of := to be = (I think) but I need a way to turn off expressions for continuation sections...perhaps NoExp in the options (like LTrim)...That's the current plan.Will the assignment-operator be = with the functionality of :=?
OMFG, the AutoHotkey forum is IP.board now (yuck!)...I may not be able to continue coming here (& I love AutoHotkey)...I liked phpBB, but not this...ugh...
Note...
I may not reply to any topics (specifically ones I was previously involved in), mostly cuz I can't find the ones I replied to, to continue helping, but also just cuz I can't stand the new forum...phpBB was soo perfect. This is 100% the opposite of "perfect".
I also semi-plan to start my own, phpBB-based AutoHotkey forum (or take over the old one, if he'll let me)
PM me if you're interested in a new phpBB-based forum (I need to know if anyone would use it)How (or why) did they create the Neil Armstrong memorial site (neilarmstronginfo.com) BEFORE he died?
...no...it's just too picky of a language...I like a language that makes sense, but doesn't require the programmer to do unnecessary things...like in C...EVERY ****ing line ends with semi-colon...no!...overkill...in JavaScript you can use them for a purpose...more commands on one line, but they aren't required...so there are things I wish AHK would do, but there are more things I hope AHK never does...being very rigid in syntax for one......v3 of Autoit has grown to a very consistant language...
Wish AHK would...
[*:ggbvis6b]use semi-colon for more things on one line (& change comment char)
wow=1;wee="wee" //comment[*:ggbvis6b]require parens on expression-if to allow for commands on same line...
if (wow="wee") msgbox, hi![*:ggbvis6b]use == instead of = in if (& as a result allow assignments in if)
if (wow=[color=blue]=[/color]"wee") msgbox, hi!Hope AHK never...[*:ggbvis6b]gets too rigid & annoying in syntax...my wishes add some rigidity to the syntax, but they each have a purpose...adding something in exchange for rigidity...
OMFG, the AutoHotkey forum is IP.board now (yuck!)...I may not be able to continue coming here (& I love AutoHotkey)...I liked phpBB, but not this...ugh...
Note...
I may not reply to any topics (specifically ones I was previously involved in), mostly cuz I can't find the ones I replied to, to continue helping, but also just cuz I can't stand the new forum...phpBB was soo perfect. This is 100% the opposite of "perfect".
I also semi-plan to start my own, phpBB-based AutoHotkey forum (or take over the old one, if he'll let me)
PM me if you're interested in a new phpBB-based forum (I need to know if anyone would use it)How (or why) did they create the Neil Armstrong memorial site (neilarmstronginfo.com) BEFORE he died?