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:

> One advantage of the GOOPS system is that several related classes can be in
> the same module and can have access to all of each other's slots.  These
> are analogous to "friend classes" in C++.

Hmm, I don't think it makes sense to talk about "classes accessing
other classes' slots" in GOOPS or CLOS-like systems in general.  A
class has no executable code that could do the accesses.  The entity
that is accessing slots is a method of a generic function, which is
not really associated with a class.

I think all you need is to restrict access to generic functions, which
is the same as restricting access to ordinary functions and is handled
by the module system.

This still leaves the question of how to implement the access policies
of other C++-like object systems in terms of GOOPS.  As Mikael, I
think this is probably best done during translation.

> However, if you wanted to define several unrelated classes in one
> file (I'm not saying this is a good idea, but people do it all the
> time in other languages), you'd have to define several modules in
> one file.  Is this possible?

You can define several modules in one file, but the semantics are the
same as defining them in multiple files.  There is no such thing as
"file scope" in the module system.
 
- Marius


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