[v1/v2] Additional special character built-in variables

Propose new features and changes
Tensai
Posts: 29
Joined: 12 Dec 2019, 14:15

Re: [v1/v2] Additional special character built-in variables

Post by Tensai » 10 Sep 2022, 11:24

For v1, I’ve often globally declared A_Quote. If I were still heavily writing in v1, I would appreciate standardizing it.

As we’re gravitating towards v2 and the focal of v1 development is bug fixes, it would be nice to have but I do not view it as necessary.

Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: [v1/v2] Additional special character built-in variables

Post by Helgef » 10 Sep 2022, 13:24

Why F?
You need something since just enabling %% in qouted strings would be a breaking change now. I just thought of python f-strings, hence the f.
surprising that _ seems uncommon as standalone syntax character
_ is a valid variable name in AHK, you are free to do _ := '"' if you like.

Cheers.

Descolada
Posts: 1192
Joined: 23 Dec 2021, 02:30

Re: [v1/v2] Additional special character built-in variables

Post by Descolada » 10 Sep 2022, 23:46

Personally I wouldn't use any of these if they were included. In v2 I don't see myself using A_Space nor A_Tab either since `s and `t exist.

neogna2
Posts: 600
Joined: 15 Sep 2016, 15:44

Re: [v1/v2] Additional special character built-in variables

Post by neogna2 » 11 Sep 2022, 05:17

Helgef wrote:
10 Sep 2022, 13:24
I just thought of python f-strings, hence the f.
I see.
Helgef wrote:
10 Sep 2022, 13:24
_ is a valid variable name in AHK, you are free to do _ := '"' if you like.
Yeah, I just meant that standalone _ is a good character for some built in use in AutoHotkey (it is prime real estate in keyboard city!). For now I'll define it for doublequote myself. :thumbup:

To everyone: Here are longer CLI examples to test if a doublequote variable can help readability. My eyes stumble on many adjacent ' and " in the current syntax. A_ variants solves that at the cost of less difference between text variable names and doublequote placeholders.
v2 current syntax:
Run('application.exe ' '"' FilePath '"' ' ' '"' parameter2 '"' ' ' '"' parameter3 '"' ' ' '"' parameter4 '"')
shorter:
Run('application.exe "' FilePath '" "' parameter2 '" "' parameter3 '" "' parameter4 '"')
variable candidates:
Run('application.exe ' A_Quote FilePath A_Quote ' ' A_Quote parameter2 A_Quote ' ' A_Quote parameter3 A_Quote ' ' A_Quote parameter4 A_Quote)
Run('application.exe ' A_DQ FilePath A_DQ ' ' A_DQ parameter2 A_DQ ' ' A_DQ parameter3 A_DQ ' ' A_DQ parameter4 A_DQ)
Run('application.exe ' A_Q FilePath A_Q ' ' A_Q parameter2 A_Q ' ' A_Q parameter3 A_Q ' ' A_Q parameter4 A_Q)
Run('application.exe ' _ FilePath _ ' ' _ parameter2 _ ' ' _ parameter3 _ ' ' _ parameter4 _)
To me _ wins at readability because it stands out from both ' and text variable names.

edit: adding kczx3's suggestion from next post, for comparison
Q := (a) => '"' a '"'
Run('application.exe ' Q(FilePath) ' ' Q(parameter2) ' ' Q(parameter3) ' ' Q(parameter4) )
Last edited by neogna2 on 11 Sep 2022, 07:39, edited 2 times in total.

User avatar
kczx3
Posts: 1649
Joined: 06 Oct 2015, 21:39

Re: [v1/v2] Additional special character built-in variables

Post by kczx3 » 11 Sep 2022, 05:57

I’d probably either just use a helper function named quote/Q or rely on syntax highlighting of escaping a double quote in a double quoted string myself

guest3456
Posts: 3465
Joined: 09 Oct 2013, 10:31

Re: [v1/v2] Additional special character built-in variables

Post by guest3456 » 11 Sep 2022, 08:28

we can call dream of days past:

Code: Select all

Run('application.exe "%FilePath%" "%parameter2%" "%parameter3%" "%parameter4%"')
why was this removed again?


Post Reply

Return to “Wish List”