Accessor Methods in JS
SlimerDude
25 Jul 2012
Ah, okay... I can use:
&x += 3 otherStuff()
and pull the // other stuff out into its own method. It'd still be easier if x += 3 worked though!
KevinKelley
25 Jul 2012
does x = x + 3 work in place of x += 3 ? I seem to remember a JS issue with the += shorthands...
SlimerDude
25 Jul 2012
Naa, I tried that. x = x + 3 generates the same JS. this.x() = ...
andy
26 Jul 2012
What version of Fantom are you running? I believe that was fixed in 1.0.62. But I have verified it works in 1.0.63.
SlimerDude
26 Jul 2012
I was under the impression it was 1.0.63 - but F4 may have been doing some 1.0.60 stuff under the covers. I'll re-check.
SlimerDude
4 Aug 2012
Yep, with my new shiny Fantom 1.0.63 F4, it all works fine.
SlimerDude
25 Jul 2012
If I define a field in a class thus:
Int x := 0 { set { &x = it // other stuff } }and somewhere in the class call
then in javascript I get an
Uncaught ReferenceError: Invalid left-hand side in assignmentThe generated JS is:
which shows it's trying to assign the computation to the accessor method. What may I do instead?