i recently opened an issue https://github.com/joyent/node/issues/5430
concerning require.extensions, and got told that 

"People should not be using require.extensions. It's officially 
deprecated", "Compile your code to JavaScript prior to running it." "There 
is never any need for additional filetype extensions. Node runs 
JavaScript"; "we're not bothered with tens of other dialects that require 
compilation and are written in code that's not readable for JavaScript 
programmer"; "stop relying on this horrible feature"

in no unclear words. i was a little shocked, since my perception has always 
been that require.extensions was the strike of a genius. with little 
effort, you can hook in filetypes and make it so that they are require'd 
transparently, no matter whether they represent data / programs as 
javascript, json, coffeescript, whatever. 

ok it's a global hook which, in theory might lead to problems (but in years 
of writing coffeescript hasn't been a problem even once.

i love the fact that i do not have to compile everything in advance / add a 
buildscript / are forced to keep a coffeescript watch process in the 
background. coming from python, i was also very happy to see that those 
pernacious *.pyc files that used to litter my directories were now a thing 
of the past—i mean, that is code duplication enforced by the system, 
utterly avoidable.

to me, javascript is a wonderful language with some rough edges and a 
horribly cluttered syntax. now here comes nodejs and all those wonderful 
home-grown programming languages that take advantage of the great compiling 
target that javascript running on nodejs is. dumbing down `require` will be 
sad news for all the many people that are using those new languages daily.

as a user of coffeescript, the fact that coffeescript compiles to 
javascript is a fact that i have to be aware of, but it is not something 
that i want to be (or need be) constantly reminded of. doing on-the-fly, 
transparent compilation is the way to go; it has never been any appreciable 
drain on resources, either. it sure will continue doing things that way. 

if they kill require.extensions with no sensible replacement, things will 
just get more difficult. it won't be too difficult to come up with a 
sensible replacement—one could even predict that sooner or later, there 
will be modules in npm that will allow you to `require 'old-require'` to 
replace the new require with the good ole'. gone a bit of efficiency, gone 
a bit of standardization.

so what are the good, the bad and the ugly facts about require.extensions? 

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to