by supersillyus · 14y ago · 0 comments
Maybe it's a matter of training, but
@_update_status_position(e, files)
looks much clearer to me than @_update_status_position e, files some_function arg_a
And then later on, decide it doesn't need an argument after all, and simply delete it: some_function
And then discover it doesn't work, because you have to remember to add the parentheses back in: some_function()
It's the little inconsistencies like that which keep driving you nuts... :)Remembering to call a function differently depending on whether it has arguments or not has been a common source of errors for me.
It's also much easier for me to parse the difference between "foo(bar(baz))" and "foo(bar, baz)" than it is for me to parse the difference between "foo bar baz" and "foo bar, baz"
(@_update_status_position e, files)
among CoffeeScript coders whenever there's a need for disambiguation. Also, it really depends. I bet that print statements don't look weird to you even though in most languages they don't use parens. Update the status position with e and files.
Update the status position, e. Files.
It parses better with single argument functions (do_something arg), but as soon as you throw that comma in there, things get confusing. $ ->
# do something on document ready
$.ajax('path', options, (data) ->
# do something with the results
Instead of $(->
# do something on document ready
$.ajax('path', options, (data) ->
# do something with the data
)
)
Those trailing parens are ugly, and they're very common if you do event-oriented javascript via closures. $.ajax('path', options) (data) ->
# do something with the data
But it does read less clearly, unfortunately.