This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 22823 - include needed
Summary: include needed
Status: RESOLVED INVALID
Alias: None
Product: WHATWG
Classification: Unclassified
Component: JavaScript (show other bugs)
Version: unspecified
Hardware: PC Windows NT
: P2 enhancement
Target Milestone: Unsorted
Assignee: Mathias Bynens
QA Contact: sideshowbarker+javascript
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-28 21:36 UTC by Jim Michaels
Modified: 2014-06-21 12:53 UTC (History)
1 user (show)

See Also:


Attachments

Description Jim Michaels 2013-07-28 21:36:10 UTC
I realize there's an import coming. I am not sure that import (?) does the same thing as an include would.
my purpose for the include would be to simply include a js file as if it were part of a library, not a package. I have some js pieces that are dependent upon others.
for example:
I have a /zeropad.js library. it is used by both the /dollar-commas.js and /time-funcs.js library.

/time-funcs.js wants to include /atoi64.js, /zeropad.js, etc.


I consider this basic language functionality. I am surprised java doesn't already have this - it would be extremely useful for large projects and preventing duplication of code and code maintenance headaches (fore instance, having to maintain 2 copies of a function instead of just 1). why wasn't this in he language before? c/c++ has it. lots of languages have it.

include '/zeropad.js';

or maybe it would take a comma-separated list of arguments (where the items are included in order) like this:

include('/atoi64.js','/getid.js','/zeropad.js','/time-funcs.js','/dollar-commas.js','/getmathfield.js'); 

would be common for me.
Comment 1 Jim Michaels 2013-07-28 21:41:48 UTC
I just found this page confirming the need for an include statement. import does not equal include. http://www.coderanch.com/t/393854/java/java/import-include
Comment 2 Jim Michaels 2013-09-03 02:35:04 UTC
I suppose a person could even do something like:
include('/atoi64.js,/getid.js,/zeropad.js,/time-funcs.js,/dollar-commas.js,/getmathfield.js'.split(',')); 
maybe taking an array of strings as a parameter would be a nice flexibility option.
Comment 3 Mathias Bynens 2014-06-21 12:53:34 UTC
This is outside the scope of the JavaScript / Web ECMAScript spec. See <http://javascript.spec.whatwg.org/#goals>.

To propose new features to the ECMAScript language, please file a bug on https://bugs.ecmascript.org/.