[erlang-questions] idea: function meta data
Tue Aug 3 06:32:58 CEST 2010
On Tuesday, August 3, 2010, Richard O'Keefe <ok@REDACTED> wrote:
>> On Nov 16, 2007 4:49 AM, Vat Raghavan <machinshin2002@REDACTED> wrote:
>>> i REALLY REALLY like the idea of meta doc strings.
>>> one possibility for a syntax for it is like pythons', which is something like this ->
>>> def func( bar )
>>> """ This is the docstring for this function
>>> and then as someone else said, in the string you can do :
>>> help(Module, func). and the shell emits ->
>>> "This is the docstring for this function"
> Lisp-style docstrings do not make sense for a language like
> ML or CAML or Clean or Haskell or Mercury or Erlang where a
> function (A) may have multiple clauses -- so there is no
> obvious unique place to *put* the docstring and (B) normally
> use pattern matching -- so the arguments often fail to have
> *names* that the docstring can talk about.
> We're left with the Quintus Prolog style of documentation
> comment, or with EDoc. Since we already *have* tools for
> EDoc, let's stick with that.
>>> then in the shell
>>> help(Module, func).
> That should be something like help(Module, Name, Arity)
> and there's not the least reason why that couldn't be
> driven off EDoc.
It'd be easier if edoc was in the BEAM which would imply keeping the
comments or using an alternative syntax. Compiler directives could
work but string quoting would be a chore.
More information about the erlang-questions