[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [GOOPS] make class-name a generic?
From: |
Mikael Djurfeldt |
Subject: |
Re: [GOOPS] make class-name a generic? |
Date: |
Fri, 27 Feb 2004 15:38:11 -0500 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) |
Andreas Rottmann <address@hidden> writes:
> (define-class <simple-type> (<gw-ffi-type>)
> (type-check #:init-keyword #:type-check)
> (wrap #:init-keyword #:wrap)
> (unwrap #:init-keyword #:unwrap))
>
> [...]
>
> (add-type! wrapset 'float
> (make <simple-type>
> #:c-type-name "float"
> #:type-check '("SCM_NFALSEP(scm_number_p(" scm-var "))\n")
> #:unwrap '(c-var "= scm_num2float(" scm-var ", 1,"
> " \"gw:scm->float\");\n")
> #:wrap '(scm-var "= scm_float2num(" c-var ");\n")
> #:ffspec 'float))
>
> The code currently does not create classes itself, but the class-name
> is supposed to refer to a class generated "from outside". The
> class-name feature is used by the guile-gobject bindings to create
> methods specialized to the classes created by guile-gobject (which has
> a built-in facility to create a GOOPS class for a GObject class). So
> it would make sense to add #:class-name '<real> in the above make
> invocation.
>
> Hope that clears it up a bit.
It does.
The situation is that we have two distinct functions, class-name of
GOOPS, which takes a class object and returns its name, and class-name
of <simple-type>, which takes a <simple-type> object and returns the
name of the class guile-gobject is supposed to create. The problem is
that of a name clash---both distinct functions are most suitably named
"class-name".
What you are asking for is to turn the GOOPS class-name getter into a
generic function so that you can distribute your getter method through
that function via the (oop goops) public interface to other modules.
While that is certainly possible, I think it's generally a better idea
to give distinct functions distinct names. What about type-name,
scm-type-name or goops-class-name?
I *do* sympathize with your criticism about name-space pollution.
Maybe a remedy would be to separate out bindings having to do with
GOOPS reflection into a (oop goops reflection) interface?
Best regards,
Mikael D.