Git Product home page Git Product logo

Comments (9)

rvirding avatar rvirding commented on July 22, 2024

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.

oubiwann avatar oubiwann commented on July 22, 2024

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.

oubiwann avatar oubiwann commented on July 22, 2024

Opened issue #87 to address the first part of this request.

from lfe.

oubiwann avatar oubiwann commented on July 22, 2024

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.

oubiwann avatar oubiwann commented on July 22, 2024

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 REPL describe or help function (I kind of like the idea of re-using the help name with arities 2 and 3)

from lfe.

yurrriq avatar yurrriq commented on July 22, 2024

Sounds good to me!

from lfe.

yurrriq avatar yurrriq commented on July 22, 2024

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.

yurrriq avatar yurrriq commented on July 22, 2024

Relevant project: https://github.com/erszcz/docsh

from lfe.

yurrriq avatar yurrriq commented on July 22, 2024

See my comment on #211. I'm working on it here for the time being.

from lfe.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.