On Thu, Dec 19, 2013 at 5:34 PM, Rick Waldron <waldron.r...@gmail.com>wrote:

>
>
>
> On Thu, Dec 19, 2013 at 3:03 PM, Andrea Giammarchi <
> andrea.giammar...@gmail.com> wrote:
>
>> It seems that I need to create N amount of garbage by design.
>>
>> This does not work, the const has already been defined:
>>
>> ```javascript
>> try {
>>   new Proxy({},{});
>>   const ES6_PROXY = true;
>> } catch(o_O) {
>>   const ES6_PROXY = false;
>> }
>> ```
>>
>
> That doesn't work anyway, not because the const has already been defined,
> but because ES6_PROXY is defined within block bodies. Same as:
>
> {
>   const IS_BOUND_TO_THE_BLOCK = true;
> }
>
>
>
>>
>> This does not work neither
>>
>> ```javascript
>> try {
>>   new Proxy({},{});
>>   var ES6_PROXY = true;
>> } catch(o_O) {
>>   var ES6_PROXY = false;
>> }
>> const ES6_PROXY = false;
>>
>> // var 'ES6_PROXY' has already been declared
>> ```
>>
>
> Because the var was hoisted up to the const's scope and const can't be
> used to redeclare an existing binding of the same name. Is ES6_PROXY meant
> to be bound in the global scope?
>
>
>
>>
>>  neither does the following
>>
>> ```javascript
>> try {
>>   new Proxy({},{});
>>   let ES6_PROXY = true;
>> } catch(o_O) {
>>   let ES6_PROXY = false;
>> }
>>
>> // Illegal let declaration outside extended mode
>>
>
> That's a Canary-specific error, but the code wouldn't do what you want
> anyway, for the same reason as the first example.
>

Also, if you want to experiment with the closest-to-spec-so-far let/const
behavior, use IE11.


Rick
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to