jashkenas / coffeescript

Unfancy JavaScript
https://coffeescript.org/
MIT License
16.5k stars 1.99k forks source link

Accept '-' on left side of ':' #3074

Closed gcao closed 11 years ago

gcao commented 11 years ago

I hope CoffeeScript can accept '-' on the left side of ':' without quotes, e.g.

style =
  padding: "3px"
  background: "#fbb"
  font-weight: "bold"

Looks better than

style =
  padding: "3px"
  background: "#fbb"
  "font-weight": "bold"
jashkenas commented 11 years ago

Nope. I'm afraid that CoffeeScript identifiers follow the same rules as JavaScript identifiers. Otherwise, the left-hand side and the right-hand side wouldn't be able to match, and that'd be pretty terrible. See previous tickets.