unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* How to implement 'class methods'
@ 2002-04-01 11:02 Andreas Rottmann
  2002-04-01 11:44 ` Andreas Rottmann
  0 siblings, 1 reply; 3+ messages in thread
From: Andreas Rottmann @ 2002-04-01 11:02 UTC (permalink / raw)


Hi!

I wonder how one could implement 'class methods' (like C++ static
methods) in GOOPS. I'd like to call them like this:

(static-method <a-class> "argument")

where <a-class> would be the class the method belongs to.

I could use 

(define-method (a-method (<class> c) args) (do-something))

but this would get invoked for all calls that pass a class as first
argument and I'd have to test if the 'right' class is passed and then
use (next-method) if not.

Regards, Andy
-- 
Andreas Rottmann         | Dru@ICQ        | 118634484@ICQ | a.rottmann@gmx.at
http://www.8ung.at/rotty | GnuPG Key: http://www.8ung.at/rotty/gpg.asc
Fingerprint              | DFB4 4EB4 78A4 5EEE 6219  F228 F92F CFC5 01FD 5B62

_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


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

* Re: How to implement 'class methods'
  2002-04-01 11:02 How to implement 'class methods' Andreas Rottmann
@ 2002-04-01 11:44 ` Andreas Rottmann
  2002-04-01 14:47   ` Neil Jerram
  0 siblings, 1 reply; 3+ messages in thread
From: Andreas Rottmann @ 2002-04-01 11:44 UTC (permalink / raw)
  Cc: guile-user

Andreas Rottmann <a.rottmann@gmx.at> writes:

> Hi!
> 
> I wonder how one could implement 'class methods' (like C++ static
> methods) in GOOPS. I'd like to call them like this:
> 
> (static-method <a-class> "argument")
> 
> where <a-class> would be the class the method belongs to.
> 
> I could use 
> 
> (define-method (a-method (<class> c) args) (do-something))
> 
> but this would get invoked for all calls that pass a class as first
> argument and I'd have to test if the 'right' class is passed and then
> use (next-method) if not.
> 
Oops, this one should rather go to -user. CC'd.

Andy
-- 
Andreas Rottmann         | Dru@ICQ        | 118634484@ICQ | a.rottmann@gmx.at
http://www.8ung.at/rotty | GnuPG Key: http://www.8ung.at/rotty/gpg.asc
Fingerprint              | DFB4 4EB4 78A4 5EEE 6219  F228 F92F CFC5 01FD 5B62

_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


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

* Re: How to implement 'class methods'
  2002-04-01 11:44 ` Andreas Rottmann
@ 2002-04-01 14:47   ` Neil Jerram
  0 siblings, 0 replies; 3+ messages in thread
From: Neil Jerram @ 2002-04-01 14:47 UTC (permalink / raw)
  Cc: guile-devel, guile-user

>>>>> "Andreas" == Andreas Rottmann <a.rottmann@gmx.at> writes:

    Andreas> Andreas Rottmann <a.rottmann@gmx.at> writes:
    >> Hi!
    >> 
    >> I wonder how one could implement 'class methods' (like C++ static
    >> methods) in GOOPS. I'd like to call them like this:
    >> 
    >> (static-method <a-class> "argument")
    >> 
    >> where <a-class> would be the class the method belongs to.
    >> 
    >> I could use 
    >> 
    >> (define-method (a-method (<class> c) args) (do-something))
    >> 
    >> but this would get invoked for all calls that pass a class as first
    >> argument and I'd have to test if the 'right' class is passed and then
    >> use (next-method) if not.
    >> 
    Andreas> Oops, this one should rather go to -user. CC'd.

I don't think this is supported yet.

I think the right way to do it would be to add `eql' specializers to
GOOPS.

        Neil


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


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

end of thread, other threads:[~2002-04-01 14:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-04-01 11:02 How to implement 'class methods' Andreas Rottmann
2002-04-01 11:44 ` Andreas Rottmann
2002-04-01 14:47   ` Neil Jerram

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