"process", "node", "window" and the global scope

87 views
Skip to first unread message

r...@tinyclouds.org

unread,
Oct 29, 2009, 12:21:40 PM10/29/09
to nodejs
There has been some discussion about simplifying the namespace.

- At the moment there is a top-level "node" object which contains
various random functions and objects which do not appear in external
libraries.

- A "process" object which is also the global scope (like "window" in
browser js) it has a couple of methods and emits some events like
"exit" and signals.

People like the sound of "process". "process.exit()" has a certain
nice ring to it. However any method added to it is necessarily then a
global object - which pollutes the global namespace.

To correct this I propose the following:

1. disconnect "process" from the global scope. it will become it's own object.

2. move everything in "node" into "process", remove the "node" object
completely.

3. add a new global object reference called "window" whose members
will only be "process" and "require".

Thoughts?

Felix Geisendörfer

unread,
Oct 29, 2009, 3:01:18 PM10/29/09
to nodejs
Yes, that sounds very good. Except the part with the name 'window' for
the global namespace. If we decide to part with the CommonJS
convention, why not go for something clean & understandable like
"GLOBAL"?

Alternatively I could imagine 'node' to stay and become the global
namespace. node.require() is a no-brainer and node.process also makes
quite some sense.

I certainly think we should not name the global namespace 'window'.

-- Felix Geisendörfer aka the_undefined

ry

unread,
Oct 29, 2009, 6:41:06 PM10/29/09
to nodejs
Came to some agreement on irc. Change commited in
ad0a4cefb8b4bf469bb1caa6e671a1009e40a81f
Sorry for the API disruption!
Reply all
Reply to author
Forward
0 new messages