This repository has been archived by the owner on Apr 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
importing and requiring behavior #2
Comments
"this" can be used instead of "exports", which is a more common idiom. I use the exports object because, there seems to be growing consensus in the serverjs community around this: https://wiki.mozilla.org/ServerJS/Modules/SecurableModules I like your suggestion too. (But I don't see how the require function could create a local variable in the outerscope?) I don't have an extremely strong opinion on this. Bring it up in the serverjs community. |
probably it is possible to implement this. with runInThisContext |
Closed
Closed
Closed
choonkeat
pushed a commit
to choonkeat/node
that referenced
this issue
Mar 28, 2012
Bug nodejs#1 occurred when trying to use process.mixin on a function and produced a fatal exception. Bug nodejs#2 occurred when trying to do a deep merge with an object containing one or more objects with a nodeType property. In those cases the deep copy for this part of the object was not performed and a shallow one was performed instead. Both of these bugs were artifacts of the jQuery.extend port.
bnoordhuis
added a commit
that referenced
this issue
Apr 10, 2013
Call SetPointerInInternalField(0, NULL) rather than SetInternalField(0, Undefined()). Fixes the following spurious NULL pointer dereference in debug builds: #0 0x03ad2821 in v8::internal::FixedArrayBase::length () #1 0x03ad1dfc in v8::internal::FixedArray::get () #2 0x03ae05dd in v8::internal::Context::global_object () #3 0x03b6b87d in v8::internal::Context::builtins () #4 0x03ae1871 in v8::internal::Isolate::js_builtins_object () #5 0x03ab4fab in v8::CallV8HeapFunction () #6 0x03ab4d4a in v8::Value::Equals () #7 0x03b4f38b in CheckEqualsHelper () #8 0x03ac0f4b in v8::Object::SetInternalField () #9 0x06a99ddd in node::ObjectWrap::~ObjectWrap () #10 0x06a8b051 in node::Buffer::~Buffer () #11 0x06a8afbb in node::Buffer::~Buffer () #12 0x06a8af5e in node::Buffer::~Buffer () #13 0x06a9e569 in node::ObjectWrap::WeakCallback ()
Closed
Closed
spolu
pushed a commit
to spolu/node
that referenced
this issue
Aug 15, 2013
Add toolsets to cares target
misterdjules
referenced
this issue
in misterdjules/node
Jul 25, 2014
Download and build libfaketime dependency if needed when running timers tests.
Closed
grahamaj
pushed a commit
to grahamaj/node-v0.x-archive
that referenced
this issue
Dec 21, 2015
Prevent npm from searching for network interfaces on solaris 10.
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I'm a bit confused by node's importing and requiring behavior. It's not clear why one must assign functions to a special 'exports' object. This could severely limit a library author's ability to reuse code between the server and client.
In my mind it would be more useful if importing behaved more similarly to Python's importing, where the assumption was that all files in a module are namespaced with the module's name if using 'require' ("import foo" in python) while everything is imported into the current scope if using 'import' ("from foo import *" in python). Of course, this is just in my mind and I don't understand the intricacies of what's happening under node's hood.
The text was updated successfully, but these errors were encountered: