On Wednesday, January 23, 2013 1:13:47 AM UTC-7, Isaac Schlueter wrote:
>
> On Tue, Jan 22, 2013 at 7:00 PM, Austin William Wright 
> <[email protected] <javascript:>> wrote: 
> > On the contrary, what sort of project could Node.js be if everyone 
> actually 
> > cared about doing things the objectively correct way. 
>
> "Objectively correct"?  Wow. 
>

If you have a problem with my logic, the correct thing to do would be 
describe what's actually wrong. If you ignore the semantics of what 
operations like require() actually *mean* then you're going to run into 
problems, or stagnate growth.

So yes, there's an "objectively correct" way to do things. And you MUST NOT 
assume that the filesystem is the only way someone would want to 
dereference a module.

But this response isn't unusual to see when people can't actually attack 
logic.
 

> Node programs run on filesystems.  Every step of indirection away from 
> "the file on the filesystem" to "the string in the require() 
> statement" is a cost.  Some of those costs provide some benefit, like 
> how require("foo") can be either locally in node_modules, or up a 
> level, so that modules can share dependencies (but don't have to, if 
> they would conflict).  Other costs, like how require("foo/bar") can be 
> either foo/bar, or foo/bar.js, or foo/bar/index.js, are simply 
> historical mistakes that seemed like a good idea at the time, but 
> provide no value, and are now too costly to remove.
>

The cost is the value of the next best alternative that must be given up. 
What's being given up? A few extra CPU cycles, worst case? That can't be 
it, the current Node.js implementation currently has to synchronously 
stat() for package.json, which should have been done away with long ago. 
The fact require() is synchronous far outweighs the magnitude of any few 
extra lines of code -- if that's even needed. The benefit of a uniform 
require() far exceeds any cost of implementation.

We were alright with adding a handler for ".json". But a uniform interface, 
that's not cool? For some reason?
 

>
> > Out of simplicity and 
> > extensibility, however, most of the time you're going to use the 
> filesystem 
> > to define a module. 
>
> 100% of the time is "most of the time", yes. 
>

As mentioned, require() may be extended to load things other than files. 
Take json, or coffeescript, for example. I think you suggested at one point 
that it'd be cool for require() to *load files off the Internet*. That's 
not a good idea, anymore?
 

> > Cross-platform compatibility is a highly desirable feature. 
>
> Cool story. 
>

Then help do something about it.

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to