[PATCH] missing 'var' in sys.inspect (was: [nodejs] strict mode)

1 view
Skip to first unread message

Isaac Schlueter

unread,
Aug 22, 2010, 4:38:45 PM8/22/10
to nod...@googlegroups.com
On Sun, Aug 22, 2010 at 13:24, Oleg Slobodskoi <ole...@googlemail.com> wrote:
> Just found an example of this issue in nodejs itself:
> http://github.com/ry/node/blob/master/lib/sys.js
>
> line 124.
>
> Don't see any declaration for variable "output".

Fixed in attached patch. Thanks!

--i

0003-Missing-var-in-sys.inspect-Found-by-Oleg-Slobodskoi.patch

Jorge

unread,
Aug 22, 2010, 6:28:58 PM8/22/10
to nod...@googlegroups.com

I've written this to monitor the creation of globals during development. Just run it once as soon as possible and it will keep logging new, fresh globals to the console in almost real time... :-)

(function () {
var global= this;
var saved= Object.getOwnPropertyNames(global);
(function globalsMonitor (current, symbols) {
current= Object.getOwnPropertyNames(global);
if (current.length !== saved.length) {
symbols= [];
current.forEach(function (v,i,o) {
if (saved.indexOf(v) < 0) {
symbols.push( v+ " ["+ typeof global[v]+ "] : "+ global[v]+ "\r\n");
}
});
console.log(symbols.length+ " new globals :\r\n"+ symbols);
saved= current;
}
setTimeout(globalsMonitor, 1e3);
})();
})();

//Create some globals to test it
var global= function(){return this}();
global.x= "x";
global.y= "y";
global.z= "z";
global.n= 27;

--
Jorge.

Oleg Slobodskoi

unread,
Aug 22, 2010, 6:30:11 PM8/22/10
to nodejs
shure, we can also use jslint for that and setup our ide to check it
every time we save,

but this all are workarounds, not a real fix of the problem.

On Aug 23, 12:28 am, Jorge <jo...@jorgechamorro.com> wrote:
> On 22/08/2010, at 22:38, Isaac Schlueter wrote:
>
Reply all
Reply to author
Forward
0 new messages