Bug in for...in?

10 views
Skip to first unread message

cha0s

unread,
Jul 18, 2010, 6:48:26 PM7/18/10
to nodejs
I was writing some code and going crazy why for...in wasn't working
the second time. The behavior can be easily reproduced using the repl:

<pre><code>$ node
Type '.help' for options.
node> var c;
node> for (c in 'one\ntwo\n') { console.log(c); }
0
1
2
3
4
5
6
7
node> for (c in 'one\ntwo\n') { console.log(c); }
node>
</code></pre>

Is this normal behavior? I tested it in the firebug JS console and I
got the behavior I expected; 0..7 both times.

Micheil Smith

unread,
Jul 18, 2010, 7:16:48 PM7/18/10
to nod...@googlegroups.com
I can confirm this. A file which exhibits this is attached, it eliminates any
errors that may be in repl.

I think this may be an issue in v8 instead.

forin-bug.js

cha0s

unread,
Jul 18, 2010, 7:40:55 PM7/18/10
to nodejs
Thank you for the confirmation. I posted it over at
http://code.google.com/p/v8/issues/detail?id=785 with a link back
here. Let's see what they say...
>  forin-bug.js
> < 1KViewDownload
>
>
>
> Micheil Smith
> --
> BrandedCode.com
> > --
> > You received this message because you are subscribed to the Google Groups "nodejs" group.
> > To post to this group, send email to nod...@googlegroups.com.
> > To unsubscribe from this group, send email to nodejs+un...@googlegroups.com.
> > For more options, visit this group athttp://groups.google.com/group/nodejs?hl=en.

Isaac Schlueter

unread,
Jul 18, 2010, 8:00:40 PM7/18/10
to nod...@googlegroups.com
This is definitely a v8 issue, not a node issue. Reproducible in the
v8 shell sample program.

(Not broken in chrome, though, so it's apparently a new-ish bug.)

--i

Jérémy Lal

unread,
Jul 19, 2010, 8:59:29 AM7/19/10
to nod...@googlegroups.com, Isaac Schlueter
On 19/07/2010 02:00, Isaac Schlueter wrote:
> This is definitely a v8 issue, not a node issue. Reproducible in the
> v8 shell sample program.
>
> (Not broken in chrome, though, so it's apparently a new-ish bug.)

Fixed upstream, see
http://codereview.chromium.org/3037008

J�r�my.

Reply all
Reply to author
Forward
0 new messages