guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Docstring as only form in a function


From: Neil Jerram
Subject: Re: Docstring as only form in a function
Date: Thu, 20 Feb 2014 17:38:22 +0000
User-agent: Roundcube Webmail/0.9.5

On 2014-02-20 16:59, Arne Babenhauserheide wrote:
Hi,

I recently experimented with docstrings, and I stumbled over not being
able to define a function which only has a docstring as body:


    (define (foo)
      "bar")

    (procedure-documentation foo)
    ⇒ #f


Adding a form makes the string act as docstring:


    (define (foo)
      "bar"
      #f)

    (procedure-documentation foo)
    ⇒ "bar"


I feel that this is inconsistent, which hurts even more, because it
breaks for the simplest showcase of docstrings.


My use case for using docstrings like this is that when I start writing
a function, I begin with the docstring. There I explain what I want to
do. Then I commit. Then I implement the function.

How does calling 'procedure-documentation' fit into this use case? Surely the most natural way, of reminding yourself what a not-yet-implemented function is supposed to do, is simply to look at its source code?

Regards,
      Neil




reply via email to

[Prev in Thread] Current Thread [Next in Thread]