Hari Krishna Dara wrote:
I found a problem with chaining function calls through the new
dictionary functions. Here is some code demonstrate the problem, if you
execute this code, the last line generates an E488 error, where as the
previous lines combines (they are equivalent) works fine.
I changed Hari's example a bit (it uses my Decho.vim debugger):
let vA = {}
function! vA.fA() dict
return 314
endfunction
call Decho("Test 1: vA=".string(vA))
call vA.fA()
let vB = {'vA': vA}
function vB.fB() dict
return self.vA
endfunction
call Decho("Test 2: vB=".string(vB))
let vC = vB.fB()
call Decho("Test 3: vC=".string(vC))
call vC.fA()
call Decho("Test 4: ")
call Decho("vB=".string(vB))
call Decho("vB.fB()=".string(vB.fB()))
call Decho("vB.fB().fA()=".string(vB.fB().fA()))
call vB.fB().fA()
The result of this is:
Test 1: vA={'fA': function('1')}
Test 2: vB={'fB': function('2'), 'vA': {'fA': function('1')}}
Test 3: vC={'fA': function('1')}
Test 4:
vB={'fB': function('2'), 'vA': {'fA': function('1')}}
vB.fB()={'fA': function('1')}
vB.fB().fA()=314
and then an E488 error (trailing characters). What's interesting is
that the
call vB.fB().fA()
fails but when used inside
string(vB.fB().fA())
it worked.
Regards,
Chip Campbell