bug-guile
[Top][All Lists]
Advanced

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

bug#67255: define-library does not support 'rename' directives


From: Maxim Cournoyer
Subject: bug#67255: define-library does not support 'rename' directives
Date: Sat, 18 Nov 2023 00:46:01 -0500

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





reply via email to

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