Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

why is id optional? define(id?, dependencies?, factory); #10

Closed
tlindig opened this issue May 13, 2013 · 2 comments
Closed

why is id optional? define(id?, dependencies?, factory); #10

tlindig opened this issue May 13, 2013 · 2 comments

Comments

@tlindig
Copy link

tlindig commented May 13, 2013

Is there a cogent reason that parameter id is optional?

I would prefer, that it would be required.

If so, the implementation of define could be run free of file specific context and would be easy and resource load could be done with better performance.

If not, define have to get the default id from the requested script filename and so it needs for every loaded module a own context.

@jrburke
Copy link
Contributor

jrburke commented May 14, 2013

Anonymous define calls are important to allow code to be moved around to different file names/directories and still work. There are no plans to force the id argument, as the anonymous modules have been very useful in practice.

@jrburke jrburke closed this as completed May 14, 2013
@unscriptable
Copy link
Member

Just adding more useful and relevant (imho) info for @tlindig: ES6 allows modules to be anonymous (no id). CommonJS only has anonymous modules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants