[a100] Parentheses no longer allowed for property calls?

Discuss the future of the AutoHotkey language
sirksel
Posts: 42
Joined: 12 Nov 2013, 23:48

[a100] Parentheses no longer allowed for property calls?

26 Oct 2018, 12:31

I've just updated to a100 from a095, and as is to be expected, a number of things broke in my scripts. Replacing <> with != was easy enough, but there is one thing that's been puzzling me. It used to be that properties could be called as either:
obj.property[p1, p2] -OR- obj.property(p1, p2) (using brackets or parentheses)

I have a number of references like this one:
itr(qty).str(dlm, x=>this) --- where itr is a top-level function, and str is a property of the class returned by itr -- in this case, with 100% optional parameters. When I change the code to itr(qty).str[dlm, x=>this] it works fine. Are parentheses no longer allowed for property calls?

I was looking through the commits trying to find if this change was intentional, but might have missed it. Can anyone help me understand the change and whether that's the entirety of the impact of that particular change?
sirksel
Posts: 42
Joined: 12 Nov 2013, 23:48

Re: [a100] Parentheses no longer allowed for property calls?

26 Oct 2018, 16:55

Thanks Helgef. I'm sure you all get this a lot, and I know you can change alpha features at any time. Was it causing problems for some new functionality? I had previously thought Lexikos was OK continuing to allow the parens calls...
lexikos wrote:
16 Nov 2015, 22:42
It's allowed for symmetry with x.y(z) := v, which is supported to facilitate converting code (or programmers ;)) from VBScript or similar. You can rely on it, but I wouldn't as a matter of style.
I was one of those you converted long ago, and I use properties for a lot of parameters-completely-optional methods so I don't have to have empty parentheses all over. Seeing them with brackets doesn't work as well. Any chance of reconsidering this one?
lexikos
Posts: 6207
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: [a100] Parentheses no longer allowed for property calls?

31 Oct 2018, 01:13

There is almost no chance of this being reverted; definitely no chance if properties and methods are separated. See Objects.

You can override the behaviour with meta-functions, although it requires structuring your object differently.

Return to “AutoHotkey v2 Development”

Who is online

Users browsing this forum: No registered users and 7 guests