dynamic property call

Report problems with documented functionality
User avatar
Posts: 22
Joined: 25 Oct 2013, 12:50

dynamic property call

06 Nov 2018, 20:28

Code: Select all

class c {
    p {
        get {
            return 42

MsgBox % {base: c}.p()
For some reason calling a property as a method leads to get execution.

It's been a while since, I assume this is intended behavior, but why?
just me
Posts: 7228
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: dynamic property call

07 Nov 2018, 11:22

It's not restricted to dynamic calls:
v2-changes -> Objects
Properties defined within a class no longer handle call (by calling the property getter). That is, obj.MyProperty() throws an exception unless a method with that name exists (it may be defined in a base class of the one which defined the property).
User avatar
Posts: 4470
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: dynamic property call

07 Nov 2018, 11:32

I think this had something to do with conversion between 2 languages.
As just me quoted correctly AHK v2 doesn't allow this anymore.
Recommends AHK Studio
Posts: 7057
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: dynamic property call

07 Nov 2018, 21:58

v1 allows a.b(x) := y to mean a.b[x] := y, even though a.b(x) and a.b[x] can potentially do two different things. Properties defined in a class provide some symmetry (though only for some objects) by making a.b(x) equivalent to a.b[x] (where b is the property).

v2 does not allow a.b(x) := y or permit 'call' for properties.

All property calls are dynamic...

Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 1 guest