unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: "Marco Maggi" <marco.maggi-ipsu@poste.it>
Subject: Re: [goops] adding a number class with generic methods
Date: Thu,  4 May 2006 21:13:15 +0200	[thread overview]
Message-ID: <IYR9E3$E5C0D83013B030AF134414D4507E68C7@poste.it> (raw)

"Neil Jerram" wrote:
>"Marco Maggi" <marco.maggi-ipsu@poste.it> writes:
> "marco.maggi-ipsu@poste.it" wrote:
>>  I do not understand why  the first solution does not work;
>>I've tried different combinations  of functions but there is
>>something I am missing.
>
> Damn... it seems to work if I do not EXPORT the generic
> methods.
>
>You mean if you remove the "(export =)" line?

Yes, with the following and no EXPORT invocation
it works.

(define-macro (make-comparison-operator class name func)
  `(begin
     (define-method (,name (a ,class) (b ,class))
       (,func (slot-ref a 'n) (slot-ref b 'n)))

     (define-method (,name (a ,class) (b <real>))
       (,func (slot-ref a 'n) (usable->mpfr b)))

     (define-method (,name (a <real>) (b ,class))
       (,func (usable->mpfr a) (slot-ref b 'n)))))

(make-comparison-operator <mpfr> = mpfr-equal?)


--
Marco Maggi




_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user


             reply	other threads:[~2006-05-04 19:13 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-04 19:13 Marco Maggi [this message]
2006-05-04 19:26 ` [goops] adding a number class with generic methods Mikael Djurfeldt
2006-05-06 23:07   ` Neil Jerram
2006-05-07  9:37     ` Mikael Djurfeldt
2006-05-07 11:45       ` Neil Jerram
2006-05-09  7:56       ` Ludovic Courtès
2006-05-09  8:30         ` Mikael Djurfeldt
2006-05-09  9:43           ` GOOPS and Code Complexity Ludovic Courtès
  -- strict thread matches above, loose matches on Subject: below --
2006-05-03  5:36 [goops] adding a number class with generic methods Marco Maggi
2006-05-04  7:47 ` Neil Jerram
2006-05-02 20:16 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='IYR9E3$E5C0D83013B030AF134414D4507E68C7@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).