Lol: now I've seen it all


This is not a question. It is just something I have to share. I have been staring at something for 15 mins that blows me away.

I break at a line of code. In the inspector watch, console, and hovering over the var show the value of my var pos as 3. Then I step over this line of code…

pos += 4;

Then watch, console, and hovering say pos is 8. If you don’t believe me I’ll make an animated gif.


In case you doubt me …


I found out what is happening. Here is the source.

pos += 4;
lineCursHdr = buf.readUInt8(pos++, true);

The pos++ in the next line is executed before it is stepped over. I han’t noticed that pos was still 8 after the next step.

I’d consider this a bug in inspector. Now back to your regularly scheduled program.


Hah good one. I think that’s that whole LHS / RHS stuff right? Some debugger’s will highlight around the inner eval’d RHS in that case right? I thought inspector did in some cases. You’re not double clicking it? Anyway 3 + 4 = 8 :stuck_out_tongue:


Yes, I’ve seen many lines that needed multiple clicks to pass over. I assume it is as you said, embedded assignments.

However this was a step-over before the pos++ code. It hadn’t gotten to that line yet. It was executing past the line it was showing.

I did one simple click and step over pos += 4;.


Oh, nice. Also, when I first read that, before you gave away that it was on the RHS, I was thinking maybe a prop watch / observe going on. So if you click step over, you wouldn’t see it (as opposed to step in) I think? Does Atom have all of the observe stuff? That is does our version of chromium etc?


Yes, I’ve used it before.


Crazy. Print-based debugging FTW!