On the former, I think you'll find most people find their implementation more readable/idiomatic, and the second case I'd guess is because they were doing a port and so probably didn't want to make too many semantic leaps.
Why are you bringing reduce() into this? Seems to fly in the face of its common purpose, stated on the MDN page: Apply a function against an accumulator and each value of the array (from left-to-right) as to reduce it to a single value.
By doing it this way, you've introduced another symbol for us to consider (hash) and by departing from the standard for loop format, you've made it less idiomatic, which means more people will have to expend mental energy parsing it.
Your first example is the exact reason I dislike CoffeeScript. Sure it's clever, but at a glance it is much harder to determine exactly what's going on.
Parent's reduce() example is harder to read than the original, and about the same length. If CoffeeScript had dictionary comprehensions like Python 2.7 / 3.x, we could make the code shorter while preserving and easier to comprehend:
@originalStyle = {k : @element.style[k] for k in ['top', 'left', 'width', 'height'}
Unfortunately this syntax was proposed and rejected [1]. But with a simple to_hash library function, you can achieve something similar [2]:
to_hash = (pairs) ->
hash = {}
hash[key] = value for [key, value] in pairs
hash
@originalStyle = to_hash ([k, @element.style[k]]
for k in ['top', 'left', 'width', 'height'])
What's with the dangling , {} on your first example? I can't tell if it's a typo or a weird wrapped line rendering issue or something. I hope that's not considered idiomatic CoffeeScript.
Just another datapoint, but contrary to the other comments here I find your reduce example a lot more readable than the original. This could be because it's fairly idiomatic ruby.
It says they mostly just ported the JS over using JS2Coffee. Maybe they plan to go back through everything and actually convert it over to coffeescript?
That being said, some of their examples are lackluster.
Should really be something like: ... though that shows off some CoffeeScript warts.Also,
Why aren't they using CoffeeScript classes?