guile-user
[Top][All Lists]
Advanced

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

Re: Ideas for making Guile easier to approach


From: Olivier Dion
Subject: Re: Ideas for making Guile easier to approach
Date: Wed, 09 Feb 2022 16:05:40 -0500

On Wed, 09 Feb 2022, Christine Lemmer-Webber <cwebber@dustycloud.org> wrote:

> Module names
> ============
>
> ice-9 -> guile
> --------------

> I think that ice-9 is a weird namespace for "guile's standard library"
> but it's what we have for historical reasons.  Still I would have
> preferred that namespace simply be "guile", so we have (guile match) and
> (guile format) instead of (ice-9 ...).  It would be clearer what ice-9
> *is* to have it be called "guile" instead.  But maybe it's too late for
> that.  How much work would it be to do an alias like this?

This is so true.  (guile) should have be the name of that module.  It
can be very confusing for newcomers. 

> Named SRFIs
> -----------
>
> If it's possible to do such aliases, I'd also say that making sense of
> what SRFI module is what is a real mess for me.  (srfi srfi-9) doesn't
> tell me what that SRFI *is*.  However, if we supported "named" versions
> of SRFIs, that would help me.  Which of these would be easier to read?

I too find this very weird.  I don't have a cheat sheet for SRFI name
mapping on my desk and it's very awkward.  Image if python was doing
this ..

        import srfi.srfi-1
        import srfi.srfi-26
        import srfi.srfi-64

now very much human friendly.

> We had:
>
>   (define-module (my-module)
>     #:use-module (guile match)
>     #:use-module (guile format)
>     #:use-module (srfi list-utils)
>     #:use-module (srfi records)
>     #:use-module (srfi args-fold)
>     #:use-module (srfi streams)
>     #:use-module (srfi tests))
>
> Much easier to follow, no?

Yes!  For the aliases I think something like this could work for now:

  (define-syntax-rule (alias-module module-name)
    (let ((mod (current-module)))
      (module-for-each (lambda (sym var) (module-define! mod sym var))
                     (module-public-interface
                      (resolve-module (quote module-name))))
      (module-export-all! mod)
    #f))

then in srfi/tests.scm:

  (define-module (srfi tests))
  (alias-module (srfi srfi-64))

Ideally, something like this should be supported instead:

  (define-module (srfi srfi-64)
    #:alias (srfi tests))

-- 
Olivier Dion
Polymtl



reply via email to

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