Restrict duplicate keys #2352

Closed
wants to merge 2 commits into
from

4 participants

@michaelficarra
Collaborator

This is my proposal for disallowing object initialisers with duplicate keys. Opened at the request of @jashkenas.

@jashkenas
Owner

Thanks for putting this on a branch. Much appreciated.

@paulmillr

just curious — why indirect eval is a shitty solution? It doesn't hit performance / minifiers like direct one.

@michaelficarra
Collaborator
  1. Creating strings of code and evaluating them dynamically is bad style. You can't always statically type or analyse it. Using it to parse a single value with a known format in the way that we are, though, is an exception, and is not very detestable.

  2. We're tightly binding the definition of CoffeeScript strings/numbers to JavaScript.

So not terrible, but still worth avoiding if we can. It's a trade-off.

@vendethiel
Collaborator

bumpin' @michaelficarra ?

@vendethiel vendethiel closed this Feb 13, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment