This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: should GOOPS be built-in?


Michael Vanier <mvanier@bbb.caltech.edu> writes:

> Essentially I'm wondering how one would use GOOPS to emulate
> C++-style object systems (or, for that matter, the object systems of
> Eiffel or python) which provide information-hiding on a
> class-by-class basis.

The mapping can be made by regarding the method in the class-centered
system as an operation with the object as first argument in the
operation-centered system (GOOPS).

> you'd have to define several modules in one file.  Is this possible?

Yes.

I guess it's easy to write a macro which creates a module containing a
GOOPS class and exports relevant things.

There may be better ways to do it, though.  Didn't Jost B. have
suggestions regarding this?  Unfortunately, I can't dig into this
now.

> Also, is there any way to implement a "protected" slot in GOOPS i.e. a slot
> which can only be accessed by an instance of a subclass?

Not in GOOPS itself, and I'm not sure it should be supported.  Again,
this is more an issue for the machinery outside GOOPS.  GOOPS only
deals with data and operations.  The operations are represented by
generic functions.  Who can do a certain operation is determined by
who can reach the generic function.

I guess this could be solved by the macro.

If one really want to tweak GOOPS into doing part of the work, one
could translate slot accesses into (ACCESSOR CONTEXT OBJECT) where
CONTEXT is the referring object.  This shouldn't be a problem.

Actually, my feeling is that a lot of these information-hiding
problems associated with emulating class-centered systems is best
handled during translation of the code.  I mean, basically, it's a
matter of syntax.  C++ methods are simple functions on the basic
level.  It's just that they have mangled names...

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]