-
Notifications
You must be signed in to change notification settings - Fork 4
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
Add description of Morganey index format #307
Conversation
As a temporary solution until #304 is resolved
Remark for myself: I think it also worth mentioning that Morganey index is not required to actually load Morganey modules, it is only needed if one wants to have the REPL autocompletion. |
I think it's not even needed for auto-completion. It would be possible to search through all directories and jar-files on the classpath to create (and cache) the morganey-index once on the start of morganey. |
@keddelzz how? Do you suggest to break the ClassLoader abstraction and traverse jars and folders manually? |
Yes. In my opinion is the abstraction provided by class loaders is not good enough. It simply lacks the feature to traverse the classpath. This can be done by breaking the abstraction and manually traversing it. |
I mean, as far as I know ClassLoader abstraction IS the classpath mechanism of JVM. Breaking the ClassLoader abstraction effectively means abandoning the JVM classpath mechanism and doing everything manually. |
@rexim i'm sorry, i think we might have a misunderstanding. I don't suggest to discard #222. We should use the classpath-mechanism of the jvm. But the classloader lacks the ability to actually scan through the contents of the classpath. However it is possible to do that manually. We could ask the classloader to give us all (class-)paths of the current program. We can traverse them and build the |
@keddelzz, as far as I know classpath may contain completely arbitrary mediums. Not only jars and folders. Breaking ClassLoader abstraction in such way locks us on jars and folders only. Adding a new type of medium for a Morganey module container will be an additional work from our side. Do you believe that jars and folders is enough for everyone? :) |
I'm completely aware of that.
Probably not. Someone will need a different source, because there's always one, who need a little extra 😄. Because I missed the stream today I have no idea how the |
# Morganey Index | ||
|
||
Morganey index is a file called `morganey-index` that is located at | ||
the root of Morganey module container. Morganey module container is a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest that you rephrase that as "the root of every Morganey module container".
Morganey index is a file called `morganey-index` that is located at | ||
the root of Morganey module container. Morganey module container is a | ||
place that is discoverable via JVM classpath mechanism (jar, folder, | ||
etc) and contains Morganey modules. For example, here is the structure |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also let's add a clarification here: "Morganey runtime can load multiple modules at once, and each of them should contain its own Index file".
@@ -0,0 +1,32 @@ | |||
# Morganey Index |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that you should add a link to this file from some documentation root (probably from the Readme file). Or will you do it later?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The root is gonna be introduce in the scope of #107
And now regarding your discussion here, guys. I think that it's practical enough to go with the Morganey Index for now. I don't think that we need some additional reflected functionality to enumerate classpath (although I believe that's possible and can be done through Google Reflection library).
Overall, I don't think that we'll really need some custom class loader support in any near future, but I don't think we should hardly restrict Morganey with the standard ones. So, we shouldn't add any sort of classpath scanner if we doubt it will be easy to couple with custom class loaders. Also, we could actually implement a morganey-index generator for jar files without Morganey index — let's just file a separated issue about that. But remember, @keddelzz, we're open for discussion. If you think that the whole Morganen Index thing is not what we want, then please let's discuss it further. |
Yeah, that was exactly the intend. We even created a test project to double check that getting all of the available indices works exactly as we expect: https://github.com/tsoding/jvm-resources-experiment
I like this idea. Module loading is performed via ClassLoader abstraction only. If one needs autocompletion he or she have to make sure that a corresponding Sounds perfect for me! You guys are awesome! :) Let's create and issue for that. I'm gonna do that. |
So I think now I understand what you meant in #307 (comment) Sorry for the misunderstanding. :) It's a pretty good idea. Thanks! |
@ForNeVeR , I didn't thought of such an unusual class-loader, thank you for reminding me.
I do think that we want the |
Fixed the remarks. |
Close #303