Remove include() add node.mixin()
authorRyan Dahl <ry@tinyclouds.org>
Mon, 5 Oct 2009 13:46:31 +0000 (15:46 +0200)
committerRyan Dahl <ry@tinyclouds.org>
Mon, 5 Oct 2009 13:46:31 +0000 (15:46 +0200)
commit8185e1fd2501d2d5001d254213c41002440ec7fc
tree0f899b26354464329572be87f33d0677a45007b7
parent522909bcbf6ff577ddf66b8c07148cf581615157
Remove include() add node.mixin()

include() should not be used by libraries because it will pollute the global
namespace. To discourage this behavior and bring Node more in-line with
the current CommonJS module system, include() is removed.

Small scripts like unit tests often times do want to pollute the global
namespace for ease. To avoid the boiler plate code of

  var x = require("/x.js");
  var foo = x.foo;
  var bar = x.bar;

The function node.mixin() is stolen from jQuery's jQuery.extend. So that it
can be written:

  node.mixin(require("/x.js"));

Reference:
http://docs.jquery.com/Utilities/jQuery.extend
http://groups.google.com/group/nodejs/browse_thread/thread/f9ac83e5c11e7e87
46 files changed:
benchmark/http_simple.js
benchmark/process_loop.js
benchmark/run.js
bin/node-repl
doc/api.txt
src/node.js
src/util.js
test/mjsunit/common.js
test/mjsunit/disabled/test-cat.js
test/mjsunit/disabled/test-http-stress.js
test/mjsunit/disabled/test-remote-module-loading.js
test/mjsunit/disabled/test_dns.js
test/mjsunit/test-buffered-file.js
test/mjsunit/test-delayed-require.js
test/mjsunit/test-event-emitter-add-listeners.js
test/mjsunit/test-exec.js
test/mjsunit/test-file-cat-noexist.js
test/mjsunit/test-fs-stat.js
test/mjsunit/test-fs-write.js
test/mjsunit/test-http-cat.js
test/mjsunit/test-http-client-race.js
test/mjsunit/test-http-client-upload.js
test/mjsunit/test-http-malformed-request.js
test/mjsunit/test-http-proxy.js
test/mjsunit/test-http-server.js
test/mjsunit/test-http.js
test/mjsunit/test-mkdir-rmdir.js
test/mjsunit/test-module-loading.js
test/mjsunit/test-multipart.js
test/mjsunit/test-process-buffering.js
test/mjsunit/test-process-kill.js
test/mjsunit/test-process-simple.js
test/mjsunit/test-process-spawn-loop.js
test/mjsunit/test-promise-wait.js
test/mjsunit/test-readdir.js
test/mjsunit/test-tcp-binary.js
test/mjsunit/test-tcp-many-clients.js
test/mjsunit/test-tcp-pingpong-delay.js
test/mjsunit/test-tcp-pingpong.js
test/mjsunit/test-tcp-reconnect.js
test/mjsunit/test-tcp-throttle-kernel-buffer.js
test/mjsunit/test-tcp-throttle.js
test/mjsunit/test-tcp-timeout.js
test/mjsunit/test-timers.js
test/mjsunit/test-utf8-scripts.js
test/mjsunit/test-wait-ordering.js