unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Mikael Djurfeldt <mikael@djurfeldt.com>
To: Jean Abou Samra <jean@abou-samra.fr>
Cc: Jacob Hrbek <kreyren@rixotstudio.cz>,
	"guile-devel@gnu.org" <guile-devel@gnu.org>
Subject: Re: Feature request: Ability to document variables like defvar in elisp
Date: Wed, 2 Nov 2022 11:15:31 +0100	[thread overview]
Message-ID: <CAA2XvwLbm4k=KsduoR-wJ9+rEYB-=PYoxt=0cgV-8PQYoBpWRQ@mail.gmail.com> (raw)
In-Reply-To: <890c5ce4-8191-54a6-dcd3-3c4b0f846415@abou-samra.fr>

[-- Attachment #1: Type: text/plain, Size: 1573 bytes --]

(define a 5)
(set-object-property! (module-variable (current-module) 'a) 'documentation
"The variable a contains a number.")

?

On Wed, Nov 2, 2022 at 9:29 AM Jean Abou Samra <jean@abou-samra.fr> wrote:

> Le 02/11/2022 à 02:08, Jacob Hrbek a écrit :
> > The ability to document variables is critical for many projects such
> > as libfive where the variables is used to declares functional computer
> > aided design structure and other projects where variables influence
> > the workflow.
> >
> > Thus proposing to change the 'define' behavior for variables to
> implement:
> >
> >     (define variable default-value docstring)
> >                                                    ^^^^^^
> >
> > Where docstring is optional and in case it's provided to call for
> example:
> >
> > (set-procedure-property! variable 'documentation docstring)
>
>
>
>
> The problem is that in Scheme, you cannot attach metadata to immediate
> values. According to the Scheme standards and the Guile documentation,
>
>
> (define a 5)
> (define b 5)
>
> (eq? a b) => may be #t or #f
> (eq? a a) => may be #t or #f
>
>
> So it's considerably more complicated than using an object property,
> because that would not work reliably for variables defined to immediates
> like numbers and characters. Instead you would need to attach the
> metadata to the name you're defining the variable to, like Elisp does,
> but unlike Guile does with procedures right now, and it's not as simple
> in Scheme due to lexical scoping.
>
> Best,
> Jean
>
>
>

[-- Attachment #2: Type: text/html, Size: 2098 bytes --]

  reply	other threads:[~2022-11-02 10:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-02  1:08 Feature request: Ability to document variables like defvar in elisp Jacob Hrbek
2022-11-02  8:28 ` Jean Abou Samra
2022-11-02 10:15   ` Mikael Djurfeldt [this message]
2022-11-04 15:10     ` Jean Abou Samra
2022-11-05  4:19   ` Jacob Hrbek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAA2XvwLbm4k=KsduoR-wJ9+rEYB-=PYoxt=0cgV-8PQYoBpWRQ@mail.gmail.com' \
    --to=mikael@djurfeldt.com \
    --cc=guile-devel@gnu.org \
    --cc=jean@abou-samra.fr \
    --cc=kreyren@rixotstudio.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).