Is it possible to make GOOPS instances applicable/callable?

Panicz Maciej Godek <[email protected]> Fri, 23 May 2025 19:37:28 +0200
Newsgroups gmane.lisp.guile.user
Message-ID <CAMFYt2asgRpex5JWaNhHjLp8Q-EYHPO40G87i=L_bFqobBh2Ww@mail.gmail.com>
Hi,
I wonder if it would be possible to make GOOPS' class instances callable,
by doing something like, say

(define apply-procedure apply)

(define-generic apply)

(define-method (apply (p <procedure>) . args)
  (apply-procedure apply-procedure p args))

In particular, I would like to be able to "call" a class instead of having
to pass it to "make":

(define-method (apply (c <class>) . args)
  (apply-procedure make c args))

but while this works with "apply" being called explicitly, i.e. (apply C)
does return a new instance of a class C, evaluating (C) alone results in a
"wrong type to apply" error.

Is this trick, i.e. overloading function calls for GOOPS instances, even
possible?


All best,
Panicz