[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Docstring as only form in a function
From: |
Mark H Weaver |
Subject: |
Re: Docstring as only form in a function |
Date: |
Thu, 27 Feb 2014 01:41:39 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
Hi Arne,
Arne Babenhauserheide <address@hidden> writes:
> I think it would be more consistent to have the first form of the body
> double as a docstring if it is a string.
I agree with others that this is a very bad idea, and would encourage
you to change your habits. However, for the sake of showing how easy it
is to modify 'define' to act the way you prefer in your own modules:
(define-syntax define
(with-syntax ((guile-define #'(@ (guile) define)))
(lambda (form)
(syntax-case form ()
((define (name . args) str)
(string? (syntax->datum #'str))
#'(guile-define (name . args) str str))
((define . rest)
#'(guile-define . rest))))))
Mark