Ah, I see, thank you so much for your answer!

Luckily this only happens in the REPL.

Just for the record, I'm using Node v9.6.1, Chrome 66.0.3359.181 on macOS
and Firefox 60.

On Wed, May 23, 2018 at 2:06 AM Ben Noordhuis <i...@bnoordhuis.nl> wrote:

> On Tue, May 22, 2018 at 9:16 PM, Huy Tr. <kingbaz...@gmail.com> wrote:
> > Hi everyone,
> >
> > I jumped into a weird problem that has different behavior in Chrome/Node
> (V8) and Firefox (SpiderMonkey).
> >
> > I'm not sure if this is a known issue that I missed, or it's a new
> problem that need to be reported/fixed.
> >
> > The scenario is, when we try to define a variable in REPL (Chrome Dev
> Tool or Node REPL) that failed first hand:
> >
> > let foo = something.does.not.exist; // this is undefined
> >
> > V8 will response as:
> >
> > VM12688:1 Uncaught ReferenceError: foo is not defined
> >     at <anonymous>:1:14
> >
> > From now on, everytime you try to redeclare that variable, or reassign
> it with a new value, it will fail,
> > the variable is no longer usable.
> >
> > let foo = "Something that works";
> > // or
> > foo = "Bar";
> >
> > Uncaught ReferenceError: foo is not defined
> >     at <anonymous>:1:8
> >
> > And the same error when you're trying to read that variable.
> >
> > With the same scenario, there's no error in Firefox. So I assume this is
> the execution problem in V8.
>
> You don't mention with what version of Chrome and Node.js that is.  I
> get different error messages with V8 6.6 but what you're seeing is per
> spec, see [0].
>
> The difference between V8 and Spidemonkey is due to a "hack" in the
> latter (a deliberate deviation from the spec) where it lets you
> reassign TDZ bindings, but only in the REPL.
>
> [0] https://github.com/nodejs/node/issues/8309
>
> --
> --
> 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.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to