bug-guile
[Top][All Lists]
Advanced

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

bug#39162: [PATCH] Fix file lookup of modules with a dot in their name.


From: Ludovic Courtès
Subject: bug#39162: [PATCH] Fix file lookup of modules with a dot in their name.
Date: Sat, 21 Mar 2020 22:46:20 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)

Hi!

Jan Nieuwenhuizen <address@hidden> skribis:

> Much to my surprise, Guile (v2.2 and 3.0 alike) fail to load a module
> that has a dot in its base name.  Directory names with dots
> (e.g. ice.10/boot-10.scm => (ice.10 boot-10)) are fine.

[...]

> -  /* If FILENAME has an extension, don't try to add EXTENSIONS to it.  */
> -  {
> -    char *endp;
> -
> -    for (endp = filename_chars + filename_len - 1;
> -      endp >= filename_chars;
> -      endp--)
> -      {
> -     if (*endp == '.')
> -       {
> -            if (!string_has_an_ext (filename, extensions))
> -              {
> -                /* This filename has an extension, but not one of the right
> -                   ones... */
> -                goto end;
> -              }
> -         /* This filename already has an extension, so cancel the
> -               list of extensions.  */
> -         extensions = SCM_EOL;
> -         break;
> -       }
> -     else if (is_file_name_separator (SCM_MAKE_CHAR (*endp)))
> -       /* This filename has no extension, so keep the current list
> -             of extensions.  */
> -       break;
> -      }
> -  }

This code mostly dates back to 1999 (commit
563841768b8659dad87296be4ae9ce589cbe99d4).  It has to do with the fact
that you can omit the extension when loading a file, in which case one
of those in ‘%load-extensions’ is picked up:

--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> (primitive-load-path "ice-9/q")
scheme@(ice-9 q)>
--8<---------------cut here---------------end--------------->8---

The usefulness of this mechanism is debatable :-), but I don’t think we
can change it during a stable release.

I wonder if there are other ways we could support file names with dots.

However, note that symbols containing dots are non-standard (R5RS does
not allow it.)

Thoughts?

Ludo’.





reply via email to

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