Re:JS 2 CoffeeScript Compiler
by walrus on Wednesday September 14, 2011 @01:14PM
(#2997026)
I don't understand why this is being downvoted. The compiler's behavior is
definitely wrong here, as you showed with your example. This issue could
even come up in practice. Suppose you have a checkbox with the id 'cb' in
your DOM. Consider the following script:
When the checkbox is clicked, it should remove the last item in the list,
then put a checkmark into the box. Run this through the Js2coffee compiler
and you will get
Run this back through the CoffeeScript compiler to get: (modified slightly
for brevity)
Notice that it now returns the result of list.pop(). Since the last item in
the list is false, this will prevent the default browser behavior, so the
checkbox will not be checked when it is clicked the first time.
[ Parent
| on HN ]
There are no comments on this comment yet.