Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Gathering ideas for AutoHotkey v.2


  • Please log in to reply
126 replies to this topic
foom
  • Members
  • 386 posts
  • Last active: Jul 04 2007 04:53 PM
  • Joined: 19 Apr 2006

a = %a%%val% values in %test%`n
; than
a := a . val . " values in " . test . "`n"
; and
a =
(
one
two
three
)
; instead of
a := "one`ntwo`nthree"
More readable, easier to maintain, avoid writing very long lines, avoid using the dreaded `...


Continuation sections would stay as they are. I don't see why you came up with that argument. Did chris mention somewhere that continuation sections wouldn't be possible anymore?
If the concatenation wouldn't be so fubar it would be much easier to write e.g.
a := a$val$" values in "$test$"`n"
Having said this there is something else that rubs me the wrong way that are variablename and the legal characters.
a-zA-Z0-9_ should get the only legal characters in variablenames to preserve special characters for operators.

No, you can use `n and `r in a regular expression too.

And thats exactly what should be abandoned from ahk. One and a shitload of ways to do the same freaking thing.

Very bad idea, it will make a pain to write Windows paths, regular expressions (all \ doubled like in Java, the horror!) and so on.

Oh i already forgot about that. You take the point. :D. Its the same as "" in strings.

There are also useful scripts in the Ask for Help section... And people might want to be able to still publish scripts for AHK 1.

Publish for ahk1? NOWAI!!!

Hmm. Yeah i thought about that and my only solution would be, as soon as the first #v2 build gets released all posts in the forum could be marked by putting [#v1] before every topic and as soon as the script gets updated the original author or a mod could remove it from the topic. This would also eliminate to create a new forum(Old Scripts And Functions Archive). But i don't know if there is some easy way to do it in the forum software.

majkinetor !
  • Guests
  • Last active:
  • Joined: --

Very bad idea, it will make a pain to write Windows paths,

C# handles that this way:

c: "c:\\path1\\path2\\.."
c# @"c:\path1\path2"

PhiLho
  • Moderators
  • 6850 posts
  • Last active: Jan 02 2012 10:09 PM
  • Joined: 27 Dec 2005

Continuation sections would stay as they are. I don't see why you came up with that argument.

You want to get rid of literal strings. The most common use of continuation sections is to build literal strings (or is built using them). So if they go, you would need to write:
a :=
(
 "one" .
 "two" .
 "three"
)
I am not fan of this...

I believe that v.2's motto should be "if it ain't broke, don't fix it". A classical in computer science...
Implicit concatenation is broken, it should go way. Plus as foom points out, the last thing we need is duplicate ways to do same things. That's good for Perl users, but confusing for most of the population of AHK users.
Dot concatenation isn't broken, why should we fix it? Any other notation is cosmetic, so isn't needed. Remember that (IMHO) v.2 is to improve the language, not to make it different to please some programmers that are nostalgic of some other language. Same of the current escape char.
Hey, Chris was kind enough to provide #EscapeChar and #CommentFlag and even #Delimiter and #DerefChar. I think these should be deprecated, but if it fullfill your view of what the syntax should look like, just use these directives in all your scripts.

BTW, speaking of other language, $ is legal in variable names in some languages (like Java)...
Posted Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
Thanks for all the ideas. I haven't read everything here yet, but I may have some responses soon as I review it and apply it to the existing rough draft of the changes planned for v2.

When the v2 plan becomes more solidified, I'll post it publicly and/or send it to those who have expressed an interest in studying and enhancing it. In any case, there will be polls and/or further public discussion over the coming months to decide the nature and extent of the changes.

Currently, I'm working on support for new expression operators such as .= (concatenate), ?: (ternary conditional operator), :=/++/-- (for use inside expressions), and comma (to support multiple statements in the same expression). Hopefully that will be done within the next few days.

foom
  • Members
  • 386 posts
  • Last active: Jul 04 2007 04:53 PM
  • Joined: 19 Apr 2006

You want to get rid of literal strings. The most common use of continuation sections is to build literal strings (or is built using them). So if they go, you would need to write:

a :=
(
 "one" .
 "two" .
 "three"
)
I am not fan of this...


I don't know how the continuation sections are handled.
If the parser simply creates one line out of them on parsing time that would probably mean we have to do what you describe. But again if concatenation wouldn't be so inconvenient. E.g. if implicit concatenation would work in all cases it wouldnt hurt to only have to enclose the strings by doublequotes. One thing is funny. First you say you don't like the space/dot/space concatenation on the other hand you say: "if it's not broken don't fix it". Since now is the opurtunity to change it, Chris should take the chance. I mean one will be forced to enclose strings in expression and statements why the hell don't make this a rule for every aspect of the language. Commands and maybe concatenation sections build an exseption, since the later ones common use is as u said to build literal strings.

I'am very curious what Chris has to say to this. I want to know if droping support for naked strings would increase the performance of expressions. And if naked strings in commands could stay, as commands get a different treatment(i suppose) by the parser/interpreter as other code.

majkinetor
  • Moderators
  • 4512 posts
  • Last active: May 20 2019 07:41 AM
  • Joined: 24 May 2006
Naked strings should go away.

Possible, the best way is to use proposed << operator, to keep the old behavior. Continuation sections can be done as

x << (
....

)
Then again, if the strings are not going to be naked, many things need rethought, like the one Chris is implementing now (comma in expressions). I really think this should be discussed in the new light.
Posted Image

PhiLho
  • Moderators
  • 6850 posts
  • Last active: Jan 02 2012 10:09 PM
  • Joined: 27 Dec 2005

One thing is funny. First you say you don't like the space/dot/space concatenation on the other hand you say: "if it's not broken don't fix it".

I believe you are mixing things up, re-read my messages...

majkinetor: x << ( is more or less the current syntax, just replacing the = with << (and allowing opening parenthesis on the same line, which isn't allowed currently). So, yes, that's the spirit.

To clarify: I am not a fan of literal strings (ie. unquoted). It makes my job of writing a lexer for AHK very hard (only AHK lexer knows when a command's parameter is an expression, a variable, a string, something else...).
Well, I find them convenient in assignments, at end of Gui commands, in MsgBox and some other uses... And I noticed that some users defends them with passion (or with a hate of quotes...). That's why I think they can be kept, but I reckon they are confusing. I often check the doc. to see if a given parameter can be an expression or only a string.

foom, I agree with you that the various ways to escape characters are confusing. I am not overly upset that "" is the escape sequence in strings, as it is used in Basic, but it is confusing for users that they have to use ,, "" `% `, {!} and so on.
Some uniformity could help here.

Chris, thanks for sharing the state of your current work, it is interesting.
Posted Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")

foom
  • Members
  • 386 posts
  • Last active: Jul 04 2007 04:53 PM
  • Joined: 19 Apr 2006
What do you guys acctualy think of swapping := and =. I say this because Chris mentioned one day that he will eventually implement support for stdin/stout and i think that << >> should be reserved for this purpose. Another reason against it is bitshift uses this operator and newbies can get coonfused by this. I think := is nice since it signals its speciality with the : and is allready know by the ahklers.

majkinetor
  • Moderators
  • 4512 posts
  • Last active: May 20 2019 07:41 AM
  • Joined: 24 May 2006
First of all, n00bs don't use bit shifting.


Second, support for stdin, stdout is useful only for console version of AHK, and thus it will be very much less used then strings.

I also think that = should be replaced with :=, not adding := functinality to =. But Chris will never accept this cuz of n00bs, witch will probably want plain "=".
Posted Image

foom
  • Members
  • 386 posts
  • Last active: Jul 04 2007 04:53 PM
  • Joined: 19 Apr 2006

First of all, n00bs don't use bit shifting.

Newbies have to learn the operators if the want to get something done.

Second, support for stdin, stdout is useful only for console version of AHK, and thus it will be very much less used then strings.

I dont talk about an ahkc version i talk about creating frontends in ahk for cmd apps and stuff like that.

I also think that = should be replaced with :=, not adding := functinality to =. But Chris will never accept this cuz of n00bs, witch will probably want plain "=".

I don't see the sence in having to type : before = just for fun.

majkinetor
  • Moderators
  • 4512 posts
  • Last active: May 20 2019 07:41 AM
  • Joined: 24 May 2006

Newbies have to learn the operators if the want to get something done.

Who told you that ?

I dont talk about an ahkc version i talk about creating frontends in ahk for cmd apps and stuff like that.

This doesn't have anything to this topic

I don't see the sence in having to type : before = just for fun.

Its your interpretation, not mine.
As this is first introduced in Pascal, witch is aknowledged as first learning language and it was generaly created for such purpose, U can be sure it is NOT just for fun. It allows later to use = for comparison without making things abiguous. So, if you stick to = for assigment, it will have 2 meanings: compare & assigment.
Posted Image

foom
  • Members
  • 386 posts
  • Last active: Jul 04 2007 04:53 PM
  • Joined: 19 Apr 2006

Who told you that ?

People who don't do that are lost anyway so lets stop talking about those people.

Stop kidding.

I don't see the sence in having to type : before = just for fun.

Its your interpretation, not mine.
As this is first introduced in Pascal, witch is aknowledged as first learning language and it was generaly created for such purpose, U can be sure it is NOT just for fun. It allows later to use = for comparison without making things abiguous. So, if you stick to = for assigment, it will have 2 meanings: compare & assigment.

That true == should be equality and === strict equality [sarcasm] but there are many voices here fearing people coming from other languages or people learning other languages are going to recognise them on the spot[/sarcasm].

majkinetor
  • Moderators
  • 4512 posts
  • Last active: May 20 2019 07:41 AM
  • Joined: 24 May 2006

People who don't do that are lost anyway so lets stop talking about those people.

And what do you think they do when they get lost ? 8)

Can't understand your sarcasm, sorry.
I was not talking about AHK anyway, but was explaining why somebody added : to = in the beginnings... :O (without trying to be fun)
Posted Image

foom
  • Members
  • 386 posts
  • Last active: Jul 04 2007 04:53 PM
  • Joined: 19 Apr 2006
Something to add to the duplicates list, AND or && and OR or ||. I prefer the non literal operators because its known from other popular languages.

PhiLho
  • Moderators
  • 6850 posts
  • Last active: Jan 02 2012 10:09 PM
  • Joined: 27 Dec 2005
I prefer the literal ones, because they are easier to understand than the symbols. Not to mention that some people can use If a > 0 | a < 5. Although I have not meet yet this case, because most users just use and/or. It could be interesting to gather stats of uses from the scripts on the forum...

foom, stop talking about "other popular languages", I believe most of the population of AHK users never programmed before, or used only Basic before...
And I explained why I believe the = symbol should not be used for literal assignment, because that's precisely why they are confused. And swapping = and := can only increase confusing!
<< is both bit shifting and stream operator in C++, and there is no confusion.
Now, I can accept other symbols, I just find this one nice...
About stdin, stdout, if they are implemented in AHK, I doubt it will be as operators, rather as functions...
Posted Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")