Hello there,
is this the assumed behaviour? As always I might be missing something of
importance, but I would expect, when overriding getAt, that it simply gets
called with the appropriate argument for "foo[bar]" expressions.
Instead, alas, for strings and gstrings, getAt is not called at all. I have
found getProperty is called instead, which seems wrong: far as I understand the
documentation (and, well, also simply by common sense) I should get getProperty
for "me.foo", but getAt for "me['foo']", should I not?
===
43 /tmp> groovy -version
Groovy Version: 2.4.7 JVM: 1.7.0_13 Vendor: Oracle Corporation OS: Mac OS X
44 /tmp> <q.groovy
class q {
static main(args) {
ExpandoMetaClass.enableGlobally()
def mmc=getMetaClass()
mmc.getAt={ index ->
println "getAt $index"
}
mmc.getProperty={ name ->
println "getProperty $name"
}
def me=newInstance()
[1,3.14,'hi',null,q,"${->'gstring'}"].each { me[it] }
}
}
45 /tmp> groovy q
getAt 1
getAt 3.14
getProperty hi
getAt null
getAt class q
getProperty gstring
46 /tmp>
===
Thanks and all the best,
OC