-
Notifications
You must be signed in to change notification settings - Fork 232
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
option to unbundle docstrings and potential consequences #1411
Comments
Further thought yields that perhaps the builtin With I believe, that this spot in specials.c#L331 might be the key point where with some compile time options docs could be written out to files instead of being dealt with in RAM. I also think it's a bit more difficult than that since there needs to be a way to keep from regenerating them per each load of a file except where stale or forcibly requested perhaps. I'm not yet sure how to do this. I'm yet to be certain how one might determine where a docs directory should be (for both janet itself, as well as jpm installed libraries) or if there should be a way to detect that something was not loaded from a standard path so don't even bother pretending to cache, regenerate completely. There would probably need to be a dynamic that allows one to build an executable with JPM that strips all doc strings completely and refuses the generation thereof. There are a bunch of points of consideration for this idea, and it probably needs more thought than me just thinking "I'll take a hack at that". That said... I'll give it some more thought, and might proceed to do just that. |
I may be mistaken, I never used it, but isn't this https://github.com/janet-lang/janet/blob/master/src%2Fconf%2Fjanetconf.h#L23 for that purpose? |
It more depends on your purpose. I believe that configuration option is to disable all docstrings in their entirety? The idea here doesn't leave docstrings disabled, but separates them out from the janet executable (and the loaded source files), eventually. EDIT: |
Some possibly related tidbits:
Perhaps a bit on the hasty side, but I think if there's a way to integrate some examples (including those that cover PEG usage) that'd be nice too:
|
The key would be if the document browser worked across all Janet platforms primarily. Figuring out how to output things capable of being dealt with from Janet's
That sounds like a good idea in the long run, a way to link towards examples such that they could be shown in line (at least, with an extended documentation/help function that isn't tied down to just handling docstrings). Perhaps the idea would be "look in all jpm directories and if there is an examples folder map them to $project/examples/$path and evaluate links that reference it like such" or something. |
I think that makes sense. |
In case someone wants to track progress, or provide feedback, or provide hints towards doing something better, I've started work on this idea here. It is absolutely awful code and I do know that. I wanted to just get some files written out and see how well the idea might could work. I've not yet implemented the Janet side, and right now a path is hard coded, as well as the option for this being hard coded. It will need a good deal of effort to get into a working and possibly acceptable state. I'll also note that creating, at this time Edit: Note... To detail what the progress is currently:
Further details:
Caveats:
I also have what I think may be an "ok" solution for the problem of stale documentation files. Check if the document exists in the "$JANET_DOC" directory (or whatever env var we need to decide to use) and if not, only ever generate it in a temporary directory (say... "/tmp/janet-docs"). There would be a switch (say I think the way The last issue would be that this has no effect on modules for Janet written in C. This exists as a problem for the These are mainly ideas of what problems there are, and probable solutions. It's likely that for some of these we'll arrive at a solution different from the one I've thought up in this post so far. This is the post I'll update when I settle on a solution or make progress on achieving the overall encompassing idea. |
Some notes for folks who might want to try things out:
I guess the last point suggests that at least |
I saw in 5de889419ff26b710b706958bf99e180d084f564 that docstrings take up RAM. This thought never crossed my mind until I saw that.
Further thought revealed there is a huge dependence on the website for more extensive documentation.
The more I gave this thought, along with @sogaiu, an idea came to mind.
What if in a production build (with
jpm
) docstrings were stripped out of the build completely. What if doc strings were stored in a separate file somewhere anddoc
knew how to look up and retrieve from it. What if the documentation system new mendoza related things and pretend mendoza had tags. A doc string could reference a tag anddoc
could be extended to understand tags, and one could then usedoc
to bring in the info from another set of files (say, the entire website but stored as mendoza documents).The idea sums up with having a way to store documentation associated with the build of Janet (both the site, and doc strings) separately from within the Janet executable, saving RAM, and leading to being able to access extensive documentation offline.
The key thing to note is that this is an idea. It may or may not be worth pursuing. I think the RAM benefits might be good, and the offline documentation benefits phenomenal. I also think it's a lot of work which means someone (be it myself or another) would have to give it a considerable amount of thought and bring it to fruition.
Finally, I realized, man pages and info pages are entirely unsuitable because Janet is cross platform and must work under windows too, and those are more unix centric documentation bundles.
If this idea has enough merit, perhaps this should be a discussion as to how such a thing might should work.
NOTE:
I believe the first thing would be to try unbundling doc strings from libraries (like spork or similar) before trying to figure out how to (in the janet executable itself) remove docstrings from the vm but have them in a file that the
doc
function can access. Next would possibly be a mendoza reader for the site (and if there aren't tag capabilities, figure out a different manner to go about it, or add such). Then somehow include the site, in mendoza, in a build of Janet (with correct build options) so one can have those offline and searchable bydoc
or referenced by doc strings somehow. After that would be getting this to work with the janet executable and for the docstrings that are generally part of the janet vm to live in another file when compiled (but remain inside the source files).The text was updated successfully, but these errors were encountered: