unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Maxime Devos <maximedevos@telenet.be>
To: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Cc: guile-devel@gnu.org
Subject: Re: [PATCH v4 4/4] load: Display modules depth in output when using %load-verbosely.
Date: Tue, 3 Oct 2023 21:03:21 +0200	[thread overview]
Message-ID: <f8f71dc7-3270-5282-32b7-91a28800b43a@telenet.be> (raw)
In-Reply-To: <87jzs53suy.fsf@gmail.com>


[-- Attachment #1.1.1: Type: text/plain, Size: 1970 bytes --]



Op 02-10-2023 om 18:13 schreef Maxim Cournoyer:
>> Something I didn't notice previously:
>>
>> Op 25-09-2023 om 16:29 schreef Maxim Cournoyer:
>>> +  if (scm_is_string (args)) {
>>> +      /* C code written for 3.9 and earlier expects this function to
>>> +         take a single argument (the file name).  */
>>> +      filename = args;
>>> +      depth = scm_from_int(0);
>>> +    }
>> IIUC, args is always a list and never a string.  However, it might be
>> a list of one element (being a string) or two elements.
> Surprisingly perhaps, this works, I guess because a string is an array.
> See the 2009 commit 31ab99de563027fe2bceb60bbd712407fcaf868e which
> exploits the same feature.

While apparently it works, that does not look like a feature to me but 
rather an accident, though I don't know what hypothetical feature you 
are referring to.  Also, sure strings are arrays, but you don't seem to 
be using that anywhere, so I'm not following.

> %load-hook is carefully crafted as to accept both one or two arguments
> (for backward compatibility).  I didn't pay attention to %load-announce
> and I'm surprised it's a public API, as its sole function seems to be
> the default %load-hook value.  

The default value might be, but it's supposed to be overwritable, and 
according to the old API it's a one-argument procedure, so if there is 
an old application/library setting it to something accepting only a 
single argument, there is your API break.

To prevent future API breaks, I propose documenting turning %load-hook 
into a keyword argument procedure with #:allow-other-keys, as something 
like:

   (lambda* (file-name #:key (depth the-default) #:allow-other-keys)
     ...)

and in the documentation mention that more keywords may be added in the 
future (and hence #:allow-other-keys).

I think it's quite plausible that there will be more such arguments in 
the future!

Best regards,
Maxime Devos.

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 929 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

  reply	other threads:[~2023-10-03 19:03 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-25 14:28 [PATCH v4 0/4] Add module depth information to %load-verbosely output Maxim Cournoyer
2023-09-25 14:28 ` [PATCH v4 1/4] (ice-9 boot-9): Fix typo Maxim Cournoyer
2023-09-25 14:28 ` [PATCH v4 2/4] .dir-locals: Set c-basic-offset to 2 for c-mode Maxim Cournoyer
2023-09-25 14:29 ` [PATCH v4 3/4] guix.scm: Update guile package native inputs Maxim Cournoyer
2023-09-25 14:29 ` [PATCH v4 4/4] load: Display modules depth in output when using %load-verbosely Maxim Cournoyer
2023-09-28 14:23   ` Maxime Devos
2023-10-02 16:13     ` Maxim Cournoyer
2023-10-03 19:03       ` Maxime Devos [this message]
2023-10-04  1:42         ` Maxim Cournoyer
2023-10-10 21:29           ` Maxime Devos
2023-10-11  2:36             ` Maxim Cournoyer
2023-10-11 12:37               ` Maxime Devos
2023-10-22  4:14                 ` Maxim Cournoyer

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=f8f71dc7-3270-5282-32b7-91a28800b43a@telenet.be \
    --to=maximedevos@telenet.be \
    --cc=guile-devel@gnu.org \
    --cc=maxim.cournoyer@gmail.com \
    /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).