Proposal for SRFI 253: In-source documentation Antero Mejr (25 May 2024 06:19 UTC)
Re: Proposal for SRFI 253: In-source documentation Vladimir Nikishkin (25 May 2024 06:25 UTC)
Re: Proposal for SRFI 253: In-source documentation Antero Mejr (25 May 2024 06:59 UTC)
Re: Proposal for SRFI 253: In-source documentation Retropikzel (25 May 2024 06:40 UTC)
Re: Proposal for SRFI 253: In-source documentation Antero Mejr (25 May 2024 06:46 UTC)
Re: Proposal for SRFI 253: In-source documentation Retropikzel (25 May 2024 07:14 UTC)
Re: Proposal for SRFI 253: In-source documentation Antero Mejr (25 May 2024 07:32 UTC)
Re: Proposal for SRFI 253: In-source documentation Retropikzel (25 May 2024 08:19 UTC)
Re: Proposal for SRFI 253: In-source documentation Antero Mejr (25 May 2024 09:02 UTC)
Re: Proposal for SRFI 253: In-source documentation Lassi Kortela (25 May 2024 10:04 UTC)
Re: Proposal for SRFI 253: In-source documentation Jakub T. Jankiewicz (25 May 2024 09:44 UTC)
Re: Proposal for SRFI 253: In-source documentation Antero Mejr (25 May 2024 10:32 UTC)
Re: Proposal for SRFI 253: In-source documentation Jakub T. Jankiewicz (25 May 2024 11:36 UTC)
Re: Proposal for SRFI 253: In-source documentation Daphne Preston-Kendal (25 May 2024 11:06 UTC)
Re: Proposal for SRFI 253: In-source documentation Antero Mejr (25 May 2024 11:23 UTC)
Re: Proposal for SRFI 253: In-source documentation Daphne Preston-Kendal (25 May 2024 11:30 UTC)

Re: Proposal for SRFI 253: In-source documentation Antero Mejr 25 May 2024 07:32 UTC

Retropikzel <xxxxxx@iki.fi> writes:

> Do I understand correctly that this is meant for kind of "one line"
> documentation not for something long form?

No, it can do one line or multiple.

> Not like this:
>
> ```
> #?
>
> ## plus
>
> Arguments:
>
> - x (number)
> - y (number)
>
> Returns:
>
> - (number) X and y added together
>
> ?#
> (define plus
> (lambda (x y)
>    (+ x y)))
> ```

That will document the plus procedure.

> But like this:
>
> ```
> #? Adds x and y together ?#
> (define plus
>    (lambda (x y)
> ```

That will also work.

> Or should it be, since you mentioned docstrings, like this?:
>
> ```
> (define plus
>    #? Adds x and y together ?#
>    (lambda (x y)
> ```

That will document the lambda procedure, but not the binding of that
procedure to the `plus` identifier.

> What happens if (read: when) I try to do this?:
>
> ```
> (define plus
>    #? Adds x and y together ?#
>    (lambda (#?number?# x #?number?# y)
>      (+ x y)))
> ```

This documents the entire lambda with " Adds x and y together ", the x
argument of the lambda with the text "number", and the y argument with
the text "number".

Keep in mind that the exporter needs to be able to understand the forms
it reads using `read-doc`.

A basic exporter may only recognize the first version, and ignore the
rest. A smarter exporter may be able create well-formatted documentation
for many different forms.

The `read-doc` procedure is general enough to support a wide range of
exporters, and LSP servers as well. But defining or providing the
exporter is beyond the scope of this SRFI. By "exporter", I am referring
to a program like Doxygen or Sphinx.