On Thu, Jun 6, 2019 at 11:29 AM Yoav Weiss <y...@yoav.ws> wrote:
>
>
>
> On Tue, Jun 4, 2019 at 5:30 PM Ross Kirsling <rkirsl...@gmail.com> wrote:
>>
>> Contact email
>>
>> rkirsl...@gmail.com
>>
>>
>> Explainer
>>
>> https://github.com/tc39/ecma262/pull/1527#issuecomment-489228449
>>
>>
>> Spec
>>
>> https://github.com/tc39/ecma262/pull/1527
>>
>>
>> Summary
>> Replace all early ReferenceErrors with early SyntaxErrors.
>>
>> Motivation
>> The spec has been inconsistent with respect to the "early ReferenceError" 
>> notion: only update/assignment expressions (e.g. `0++`, `0 = 0`) have had 
>> early ReferenceErrors, while other invalid assignment target cases like `[0] 
>> = []` and `for (0 of []) {}` have been early SyntaxError.
>>
>> Furthermore, this becomes an observable concern with eval: if eval throws a 
>> ReferenceError, the user has had no way to know whether the code was 
>> actually executed or simply parsed (short of matching on error message 
>> strings).
>>
>> Risks
>> Interoperability
>> None. This reached consensus at TC39, it received explicit positive feedback 
>> from all major engines, and it is already shipping in Safari TP 83.
>>
>> Compatibility
>> None expected. This simply changes a parse-time error type. As mentioned 
>> above, it would have been nearly impossible for userland code to depend on 
>> this typing.
>
>
> I'm confused. Above you say "this becomes an observable concern with eval" 
> which seems to contradict your "Compatibility" section.

I think Ross is trying to say that it becomes *less* of a concern with
this change. Previously, with a ReferenceError you wouldn't know if it
was an early error or not. But now, with this change, you will know
for sure that a ReferenceError is not an early error. This change
makes everything more consistent.

> Can you elaborate on the observability of this change and how would code that 
> depends on it may look like? (if it can be observed)

The observability of this change is that all early errors that were
ReferenceErrors are now SyntaxErrors. If previously you had code that
eval'd something that resulted in a ReferenceError, it will now be a
SyntaxError.

In the following example,
```
try {
  eval('0 = 0');
} catch (e) {
  if (e instanceof ReferenceError) {
    doFoo();
  } else {
    doBar();
  }
}
```

this change will run doBar, instead of doFoo.

I don't expect to see code that special cases against ReferenceError
in the wild especially for just early errors. I expect to see code
that handles both ReferenceErrors and SyntaxErrors. Since we're not
adding a new type of error, I wouldn't expect to see any breakage.

Thanks,
--Sathya



>>
>> Will this feature be supported on all six Blink platforms (Windows, Mac, 
>> Linux, Chrome OS, Android, and Android WebView)?
>> Yes.
>>
>> Is this feature fully tested by Test262?
>> Yes: https://github.com/tc39/test262/pull/2147
>>
>> Link to entry on the feature dashboard
>> https://www.chromestatus.com/feature/5756460363415552
>>
>> Requesting approval to ship?
>> Yes.
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "blink-dev" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to blink-dev+unsubscr...@chromium.org.
>> To view this discussion on the web visit 
>> https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAHnZyqBi3XLxmrsCUVt1tcOirf4rQzz_RwzHh89%2B0zCk0B-e6w%40mail.gmail.com.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "blink-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to blink-dev+unsubscr...@chromium.org.
> To view this discussion on the web visit 
> https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CACj%3DBEiHuLpw%3D7wU8Hya4%2B-0X6MNcUm5Pvbn4Xwy-u9PSp%3DbCw%40mail.gmail.com.

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/v8-users/CAMd%2BM7zjnOFi1L_S%3Dd_EDo%3D%3D9tiL9dpdFfwYPfvgQwsXeYDjsA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to