3 ms·
The following are all equivalent: request(url, (response) -> handle response , (error) -> handle error ) request(url, (resp
by wmil 13y ago
The following are all equivalent:
request(url, (response) ->
handle response
, (error) ->
handle error
)
request(url,
(response) ->
handle response
(error) ->
handle error
)
request(url
(response) ->
handle response
(error) ->
handle error
)
request url, \
(response) ->
handle response
,
(error) ->
handle error
request url, (response) ->
handle response
,
(error) ->
handle error
It's very reasonable for a JS developer to be confused when seeing those.
- unquietcode 13y agoIf you can't see what all of these have in common, then you probably shouldn't call yourself a software developer. It's just syntax, people.
- lucisferre 13y agoI'll be the first to admit, I still find it a bit of an awkward syntax, and it was one of the parts of the syntax I kept bumping up against for the longest time. Amazingly I'm finally comfortable with it, but there is a kind of cognitive friction around that one. Personally, I blame whitespace significance. It's hard for whitespace to be both significant to syntax and formatting without impacting one or the other negatively. The principle argument against whitespace significant languages is separation of concerns. Punctuation only for syntax and whitespace only for formatting. That said the benefits of CoffeeScript still outweigh the tradeoffs for me.