Comments (9)
The first bit is not too difficult, we just need to define a way to store the comment string inside the module. Either as attributes or have a function which returns the doc strings.
This shouldn't be too difficult either once we have defined the formats. Unfortunately we can't call (describe '#foo:bar/1) as the #' results in a fun and not in the actual values. This is done very early.
Edoc is worse as it know about erlang comments and syntax. We would need a new front-end to it, or some plugins if it supports that. Or use something else. I am not really an edoc fan. :-)
from lfe.
On Sun, Apr 27, 2014 at 6:12 PM, Robert Virding [email protected]:
The first bit is not too difficult, we just need to define a way to store
the comment string inside the module. Either as attributes or have a
function which returns the doc strings.
That's good news!
This shouldn't be too difficult either once we have defined the formats.
Unfortunately we can't call (describe '#foo:bar/1) as the #' results in a
fun and not in the actual values. This is done very early.
Hrm, interesting. Didn't know that's how it worked... Would it be possible
to do something like (describe 'module 'function) or (describe
'module:function)?
Edoc is worse as it know about erlang comments and syntax. We would need a
new front-end to it, or some plugins if it supports that. Or use something
else. I am not really an edoc fan. :-)
Good to know! I've used Javadoc and Pydoc in the past... and it was more of
a pain than anything else. I always ended up writing prose in my
docstrings/comments instead, not using any of the markup. I'm cool with not
even exploring this, then :-)
from lfe.
Opened issue #87 to address the first part of this request.
from lfe.
With regard to @rvirding's second point, I guess we could just do this:
> (describe 'mod 'func n)
where n
is the arity. We could also provide a sane default for this:
> (describe 'mod 'func)
where perhaps the default arity selected would be the one with the longest docstring ...
from lfe.
As to the docstring storage ... what about this:
- put it in the module's attributes
- make the key the atom
docstrings
- make the value a list of key/value tuples where each key would be
#(func n)
and the value would be the docstring for that function + arity. - look-ups would then be done like this:
(lists:keyfind #(func n) 1 (mod:module_info 'docstrings))
(which, of course, would be wrappted by a REPLdescribe
orhelp
function (I kind of like the idea of re-using thehelp
name with arities 2 and 3)
from lfe.
Sounds good to me!
from lfe.
Lodox might be of some use. I'd be down to make changes if it helps achieve the goals described here. An interesting feature to note is that lodox-parse:docs/1
produces a giant map of parsed metadata, including docstrings and arglists/patterns.
For reference, parsed function (and macro) maps look like this:
'#m(name func
arity 2
patterns ((x y))
doc "func/2 does something really cool.")
from lfe.
Relevant project: https://github.com/erszcz/docsh
from lfe.
See my comment on #211. I'm working on it here for the time being.
from lfe.
Related Issues (20)
- Record accessors in guards don't work HOT 3
- Feature Request: Github Discussions HOT 1
- Run tests without rebar3 HOT 4
- Add make targets for testing HOT 1
- README: Run tests with Makefile HOT 3
- Improve workflow for publishing LFE to hex.pm
- Odd recursion bug with rebar3_lfe as a plugin dep HOT 1
- v2.1.1 tagged but not marked as latest HOT 5
- lc/2 not defined HOT 8
- ets-ms is attempting to match 'undefined' when using match-record with unspecified slots HOT 5
- Error expanding (seemingly valid) qlc macro HOT 12
- Extend documentation for patterns HOT 2
- CI/CD no longer runs on older builds HOT 4
- Type definitions and specifications do not accept empty list syntax HOT 1
- Issues with LFE and Erlang 26.0 (user:start) HOT 5
- Make banner functions public for re-use in rebar3_lfe
- Consider using Erlang's shell:start_interactive for 26+ HOT 1
- Explore the possibility of making the LFE REPL developer experience more configurable HOT 2
- module-alias is ignored for macros HOT 1
- Pattern matching on nested literals with underscore. HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lfe.