unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* bug#67255: define-library does not support 'rename' directives
@ 2023-11-18  5:46 Maxim Cournoyer
  2023-11-20 15:53 ` Timothy Sample
  2023-11-24 21:01 ` bug#67255: [PATCH v2] Use R7RS 'rename' syntax for exports Maxim Cournoyer
  0 siblings, 2 replies; 6+ messages in thread
From: Maxim Cournoyer @ 2023-11-18  5:46 UTC (permalink / raw)
  To: 67255

Hi,

Our R7RS define-library syntax, from (ice-9 r7rs-library) does not
support renaming bindings to export, via 'rename' directives.  For
example, attempting to build srfi/125.sld, which reads:

--8<---------------cut here---------------start------------->8---
(define-library (srfi srfi-125)

  (export

   make-hash-table
   hash-table
   hash-table-unfold
   alist->hash-table

   hash-table?
   hash-table-contains?
   hash-table-empty?
   hash-table=?
   hash-table-mutable?

   hash-table-ref
   hash-table-ref/default

   hash-table-set!
   hash-table-delete!
   hash-table-intern!
   hash-table-update!
   hash-table-update!/default
   hash-table-pop!
   hash-table-clear!

   hash-table-size
   hash-table-keys
   hash-table-values
   hash-table-entries
   hash-table-find
   hash-table-count

   hash-table-map
   hash-table-for-each
   hash-table-map!
   hash-table-map->list
   hash-table-fold
   hash-table-prune!

   hash-table-copy
   hash-table-empty-copy
   hash-table->alist

   hash-table-union!
   hash-table-intersection!
   hash-table-difference!
   hash-table-xor!

   ;; The following procedures are deprecated by SRFI 125:

   (rename deprecated:hash                     hash)
   (rename deprecated:string-hash              string-hash)
   (rename deprecated:string-ci-hash           string-ci-hash)
   (rename deprecated:hash-by-identity         hash-by-identity)

   (rename deprecated:hash-table-equivalence-function
                                               hash-table-equivalence-function)
   (rename deprecated:hash-table-hash-function hash-table-hash-function)
   (rename deprecated:hash-table-exists?       hash-table-exists?)
   (rename deprecated:hash-table-walk          hash-table-walk)
   (rename deprecated:hash-table-merge!        hash-table-merge!)

   )

  (import (scheme base)
          (scheme write) ; for warnings about deprecated features
          (srfi 126)
          (except (srfi 128)
                  hash-salt      ; exported by (srfi 126)
                  string-hash    ; exported by (srfi 126)
                  string-ci-hash ; exported by (srfi 126)
                  symbol-hash    ; exported by (srfi 126)
                  ))

  (cond-expand
   ((library (scheme char))
    (import (scheme char)))
   (else
    (begin (define string-ci=? string=?))))

  (include "srfi-125/125.body.scm")

  )
--8<---------------cut here---------------end--------------->8---

Fails with:

--8<---------------cut here---------------start------------->8---
$ ./meta/guild compile -W3 ./module/srfi/srfi-125.scm
/module/srfi/srfi-128.scm.go
ice-9/boot-9.scm:1682:22: In procedure raise-exception:
Syntax error:
unknown location: source expression failed to match any pattern in form ((rename deprecated:hash hash) (rename deprecated:string-hash string-hash) (rename deprecated:string-ci-hash string-ci-hash) (rename deprecated:hash-by-identity hash-by-identity) (rename deprecated:hash-table-equivalence-function hash-table-equivalence-function) (rename deprecated:hash-table-hash-function hash-table-hash-function) (rename deprecated:hash-table-exists? hash-table-exists?) (rename deprecated:hash-table-walk hash-table-walk) (rename deprecated:hash-table-merge! hash-table-merge!))
--8<---------------cut here---------------end--------------->8---

Our define-module syntax does not have such a feature (of renaming
*exported* bindings), so this would seem to require new development on
that side first.

-- 
Thanks,
Maxim





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-11-24 21:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-18  5:46 bug#67255: define-library does not support 'rename' directives Maxim Cournoyer
2023-11-20 15:53 ` Timothy Sample
2023-11-20 17:14   ` Timothy Sample
2023-11-23  3:57     ` Maxim Cournoyer
2023-11-23 16:12       ` Timothy Sample
2023-11-24 21:01 ` bug#67255: [PATCH v2] Use R7RS 'rename' syntax for exports Maxim Cournoyer

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).