Propose simpler string constant

Coroutines coroutines at gmail.com
Wed Dec 16 11:31:26 UTC 2015


On Wed, Dec 16, 2015 at 3:20 AM, Thomas <thomasjamesfoster at bigpond.com> wrote:
> IMHO it'd be a huge mistake to not use symbols for enums.
>
> In my head this:
>
> const colours = enum {
>   Red,
>   Yellow,
>   Green,
>   Blue
> }
>
> should 'desugar' to something like this in ES6:
>
> const colours = {
>   Red: Symbol('Red'),
>   Yellow: Symbol('Yellow'),
>   Green: Symbol('Green'),
>   Blue: Symbol('Blue')
> }
>
> Thomas

This person gets it. +1  :-)


More information about the es-discuss mailing list