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

Support require.extensions to support multi-language modules #160

Closed
hns opened this issue Nov 29, 2011 · 4 comments
Closed

Support require.extensions to support multi-language modules #160

hns opened this issue Nov 29, 2011 · 4 comments
Milestone

Comments

@hns
Copy link
Collaborator

hns commented Nov 29, 2011

Node.js supports a require.extensions object to register handlers for loading modules from alternative languages, using the file extension as keys.

Also see usage in coffee-script: http://jashkenas.github.com/coffee-script/documentation/docs/coffee-script.html

@hns
Copy link
Collaborator Author

hns commented Feb 6, 2012

This feature should probably support two formats: JavaScript source code for languages that compile to JS and Java bytecode. The latter allows us to support precompiled modules.

One open question is how Java modules should be provided: raw byte arrays or prelinked and -loaded classes?

@aaditmshah
Copy link

That sounds like a really good feature. It also means that we'll be able to integrate Clojure, Groovy, Scala, Erlang, Python, Ruby, and every other language that uses the JVM seamlessly with Ringo. That's a really big plus point for a growing CommonJS implementation.

I just have one doubt - if we'll be using Java class files as modules then I assume that we'll be exporting the class itself. In that case the static members of the class will be the exported methods and properties of the required object right? So we'll be able to require a class and create instances of it. What about including class files. Then we'll only be able to use the static members if I'm not mistaken.

Also, how will interfaces be required or included in Ringo? I think that's something that needs to be given some thought.

@hns
Copy link
Collaborator Author

hns commented Feb 7, 2012

The ability to load Java class files here does not mean any class files. This will be limited to JS scripts compiled to class files by Rhino.

We will not load and represent generic Java classes as CommonJS modules. The semantics wouldn't be clear, and we can already access these classes with Rhino as it is.

@hns
Copy link
Collaborator Author

hns commented Feb 8, 2012

Fixed in 20eee67

@hns hns closed this as completed Feb 8, 2012
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

2 participants