guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: goops C interface


From: Michael Livshin
Subject: Re: goops C interface
Date: 28 Oct 2000 12:26:47 +0200
User-agent: Gnus/5.0807 (Gnus v5.8.7) XEmacs/21.1 (20 Minutes to Nikko)

Dirk Herrmann <address@hidden> writes:

> On Fri, 27 Oct 2000, Eric Moore wrote:
> 
> > 1) do people prefer some kind of giant varargs style function that
> >    defines a class, or one that takes a struct that defines it?
> 
> I'm not sure about the problems that arise from adding slots
> incrementally.  I would prefer such an approach.  However, if it is
> actually a bad thing to add slots incrementally to a class definition, why
> not use an intermediate construct (in the simplest case a list) which is
> incrementally filled with slot definitions, and to actually create a
> class this intermediate construct is then passed as a parameter?

nice idea.

here's another one for consideration:

foo = scm_c_make_class ("<foo>",                       /* name */
                        scm_listify (bar, baz),        /* ancestors */
                        scm_listify (                  /* slots */
                           scm_c_make_slotdef ("one", SCM_EOL),
                           scm_c_make_slotdef ("two",
                              SCM_CONS (scm_k_initvalue, SCM_NUM0),
                              SCM_CONS (scm_k_accessor, get_two))));

the point being that `scm_listify' already exists, so there are no
hard stylistic choices to make about it.

and if we define some handy macros, the above shrinks to this:

foo = SCM_MAKE_CLASS ("<foo>",
                      (bar, baz),
                      (SCM_SLOTDEF ("one", ()),
                       SCM_SLOTDEF ("two", ((scm_k_initvalue, SCM_NUM0),
                                            (scm_k_accessor, get_two)))));

-- 
Perhaps it IS a good day to die; I say we ship it!
                                        -- Klingon Programmer




reply via email to

[Prev in Thread] Current Thread [Next in Thread]