On 10/12/2009 09:49 AM, Ray Dillinger wrote:
> In the spirit of scheme, I would propose "import" as a binding
> form that is fully part of the language, which can be used
> wherever binding forms are legal and which establishes bindings
> that respect the lexical scope in which the "import" form is
> evaluated. And, yes, which is not limited or restricted by
> requiring a "before macroexpansion" or "after macroexpansion"
> condition.

That's what it is in Kawa (modulo bugs - I haven't really tested
import except at top-level, but in principle it should work).

Here is the start of srfi69.scm:

(module-compile-options warn-undefined-variable: #t
                         warn-invoke-unknown-method: #t)
(provide 'srfi-69)
(provide 'hash-table)
(export make-hash-table hash-table? alist->hash-table
         hash-table-equivalence-function hash-table-hash-function
         hash-table-ref hash-table-ref/default hash-table-set!
         hash-table-delete! hash-table-exists?
         hash-table-update! hash-table-update!/default
         hash-table-size hash-table-keys hash-table-values
         hash-table-walk hash-table-fold hash-table->alist
         hash-table-copy hash-table-merge!
         hash string-hash string-ci-hash hash-by-identity)
(import (kawa hashtable))
(import (rename (except (rnrs hashtables)
                          string-hash string-ci-hash symbol-hash)
                  (hashtable-delete! hash-table-delete!)
                  (hashtable-contains? hash-table-exists?)
                  (hashtable-set! hash-table-set!)
                  (hashtable? hash-table?)
                  (hashtable-size hash-table-size)))

(define *default-bound* #x100000000)

(define (string-hash (s :: <string>)
                      #!optional (bound :: <integer> #!null))
   (let ((h :: <int> (*:hashCode s)))
     (if (eq? bound #!null) h (modulo h bound))))

etc etc

-- 
        --Per Bothner
[email protected]   http://per.bothner.com/

_______________________________________________
r6rs-discuss mailing list
[email protected]
http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss

Reply via email to