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
.
Written by David Zitao Zhang
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Livescript
Authors
Related Tags
#livescript
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#