From: "Marco Maggi" <marco.maggi-ipsu@poste.it>
Subject: integer? as generic function
Date: Fri, 19 May 2006 20:50:50 +0100 [thread overview]
Message-ID: <IZJ34Q$6F34E0B92EAAFB44871F99F6902B42C0@poste.it> (raw)
Ciao,
when I execute The Code:
(define-generic gee-gmp-oop-integer?)
(let ((integer? integer?))
(define-method (gee-gmp-oop-integer? (o <number>))
(integer? o)))
(set! integer? gee-gmp-oop-integer?)
in a script I get no error.
If I put The Code in a module and then load it in a
script, I get no error.
If I put The Code in a module and load it from a
module, loaded from a script, I get:
Backtrace:
In unknown file:
?: 10 (let ((var1 #) (var2 #)) (if (not #) (begin # #)))
...
?: 11 (begin (if # #) (let* # #))
?: 12* (if (not duplicates-interface) (begin # #))
?: 13 (begin # #)
?: 14* (set! duplicates-interface
(make-duplicates-interface))
?: 15* [make-duplicates-interface]
?: 16 (let* ((m #)) (set-module-kind! m (quote
custom-interface)) ...)
?: 17* [make-module]
?: 18 (letrec (#) (if # #) (let # # # ...))
?: 19 (let (# # #) (if # #) (if # #) ...)
?: 20* (if (not (integer? size)) (error "Illegal size to
make-module." size))
?: 21* [not ...
?: 22* [gee-gmp-oop-integer? 31]
?: 23*
Exception during displaying of backtrace: misc-error
<unnamed port>: In procedure gee-gmp-oop-integer? in
expression (integer? (cadddr x)):
<unnamed port>: mutex already locked by current thread
the line that causes the error is:
(set! integer? gee-gmp-oop-integer?)
if I comment it out the module loads, but I cannot
define the generic method. Trying to define a generic
method without "the trick" I get:
#<primitive-procedure integer?> is not a valid generic function
When I import the modules I use:
(define-module (gee gmp mpfr-oop)
#:use-module (srfi srfi-10)
#:use-module (ice-9 syncase)
#:use-module (ice-9 optargs)
#:use-module ((gee gmp mpfr)
#:renamer (symbol-prefix-proc 'smob-))
#:duplicates merge-generics
#:use-module (oop goops)
#:use-module (gee gmp oop)
#:esport (...))
(gee gmp oop) is the module that contains The Code,
and in the script:
(define-module (mpfr-goops-test)
#:use-module (gee gmp mpfr-oop)
#:duplicates merge-generics)
The modules (mpfr-goops-test) and (gee gmp mpfr-oop)
have no opportunity do to anything, because the error
happens when #:use-module loads (gee gmp oop).
Is there a way to circumvent that problem (whatever
it is) and have INTEGER? as generic function?
I'm using the same code with a number of other
functions (nan?, inf?, abs, round, sin, cos, ...)
but INTEGER? is the only one that causes problems.
--
Marco Maggi
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user
next reply other threads:[~2006-05-19 19:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-05-19 19:50 Marco Maggi [this message]
-- strict thread matches above, loose matches on Subject: below --
2006-05-23 18:58 integer? as generic function Marco Maggi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='IZJ34Q$6F34E0B92EAAFB44871F99F6902B42C0@poste.it' \
--to=marco.maggi-ipsu@poste.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).