Propose simpler string constant

Alexander Jones alex at weej.com
Tue Dec 15 21:54:06 UTC 2015


TypeScript has this already, so I'm sure we can learn a thing or two from
their implementation.

On 15 December 2015 at 19:56, Andrea Giammarchi <andrea.giammarchi at gmail.com
> wrote:

> Jordan AFAIK you can't have undefined const declaration so your concern is
> unfounded.
>
> However, I'm pretty sure what Brendan says **is** indeed what developers
> want so I'd +1 that without problems.
>
> Regards
>
> On Tue, Dec 15, 2015 at 4:44 PM, Jordan Harband <ljharb at gmail.com> wrote:
>
>> That seems hazardous - if someone is converting a "var" codebase to
>> "const" and "let", and they convert `var foo;` to `const foo;` expecting it
>> to be undefined, the current TDZ error will be much more helpful to them
>> than a silent change of meaning in their code to `const foo = 'foo';`.
>>
>> On Tue, Dec 15, 2015 at 8:35 AM, Kip Obenauf <mozilla at turtlebyte.com>
>> wrote:
>>
>>> A common pattern I see is this:
>>> const ADD_ALL_THE_STUFF = 'ADD_ALL_THE_STUFF'
>>>
>>> Would it be helpful to allow a shorter version of this to be:
>>> const ADD_ALL_THE_STUFF
>>>
>>> Rather than have that just be forever undefined, it could automatically
>>> refer to a string of the same name, i.e. 'ADD_ALL_THE_STUFF'.
>>>
>>> _______________________________________________
>>> 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/20151215/08e24ba5/attachment.html>


More information about the es-discuss mailing list