Propose simpler string constant

Steve Kinney hello at stevekinney.net
Thu Dec 17 20:33:03 UTC 2015


I did some initial thinking about this and looked at Rust and Swift as
prior art. I started something similar to what was being discussed but came
across some edge cases as I went along.

https://github.com/stevekinney/ecmascript-enumerations

Right now, it's just a draft of notes and thoughts, but I am working on a
draft implementation with Sweet.js.

On Thu, Dec 17, 2015 at 1:03 PM, Rick Waldron <waldron.rick at gmail.com>
wrote:

>
>
> On Wed, Dec 16, 2015 at 7:27 AM Thomas <thomasjamesfoster at bigpond.com>
> wrote:
>
>> Out of curiosity, is anyone working on a proposal for enum? Given the
>> keyword has been reserved for so long, it seems a little strange for a
>> proposal not to be floating around - unless I've missed something.
>>
>
> Yes. It's an early draft, but I will get it onto github as soon as
> possible.
>
> Rick
>
>
>> > On 16 Dec 2015, at 10:31 PM, Coroutines <coroutines at gmail.com> wrote:
>> >
>> >> 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  :-)
>> > _______________________________________________
>> > es-discuss mailing list
>> > es-discuss at mozilla.org
>> > https://mail.mozilla.org/listinfo/es-discuss
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at mozilla.org
>> https://mail.mozilla.org/listinfo/es-discuss
>>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20151217/bfd386fb/attachment.html>


More information about the es-discuss mailing list