r/programming • • Jul 25 '13

CoffeeScript's Scoping is Madness

http://donatstudios.com/CoffeeScript-Madness
211 Upvotes

315 comments sorted by

View all comments

Show parent comment

1

u/redditthinks Jul 26 '13 edited Jul 26 '13

The rule that implicit parentheses (generally) follow, is that they extend to the end of the line, or to the end of the block that ends the line.

Hmm, good point. However, that encourages what I see as 'floating arguments'. Extending to the end of the line is a good idea if it doesn't meet an operator, like the example on the front page:

console.log sys.inspect object

Furthermore, I think it would be good to encourage wrapping a long argument with operators in parenthesis.

If you don't mind the new line

That's the problem :)

A common example is a long URL which are sensitive to new lines, extra spaces, etc. I think the current implementation of double quoted, multiline strings is very limited as it only works properly in the outermost scope, otherwise it doesn't respect indentation, making the code look out of place (and interfering with Vim's folding ;) ).