9ozgsa
Last Updated: February 25, 2016
·
287
· gwwfps
598e551662be17581d46c6198338e532

Be careful calling methods with ... in LiveScript

One thing to keep in mind while using obj.func ... in LiveScript is that its semantics are to take the object obj.func and call it using the same context and arguments as the current function.

It might be tempting to see it as some sort of macro that passes through arguments, but it actually compiles into obj.func.apply(this, arguments).

So if you want to call the function as a method on the object obj, it's necessary to use the binding syntax obj~func.

Say Thanks
Respond