Propose simpler string constant

Rick Waldron waldron.rick at gmail.com
Thu Dec 17 20:02:39 UTC 2015


On Wed, Dec 16, 2015 at 6: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')
> }
>
>
When Brendan mentioned enum earlier in this thread I started writing a
proposal, which has evolved into exactly this. I should have something
worth reading by next week.

Rick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20151217/996ceb6b/attachment.html>


More information about the es-discuss mailing list