Re: CLOS and C++
From: Peter Seibel (peter_at_javamonkey.com)
Date: 11/25/03
- Next message: Duane Rettig: "Re: More static type fun."
- Previous message: Peter Seibel: "Re: CLOS and C++"
- In reply to: Geoffrey Summerhayes: "Re: CLOS and C++"
- Next in thread: Roman Belenov: "Re: CLOS and C++"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 25 Nov 2003 07:56:39 GMT
"Geoffrey Summerhayes" <sRuEmMrOnVoEt@hotmail.com> writes:
> "Steven E. Harris" <seharris@raytheon.com> wrote in message
> news:q671xrx1mwe.fsf@raytheon.com...
> > heliosc@mindspring.com (Rayiner Hashem) writes:
> >
> > > I think the reasoning is that in Lisp/CLOS encapsulation is
> > > orthogonal to the class mechanism. If you want to prevent a client
> > > from changing a class's internal members, put it in a seperate
> > > package and don't export the setter methods for that member.
> >
> > Ah, I had not thought of that. At the time I was reading the
> > aforementioned Norvig book, I didn't understand CL packages, but
> > thinking about it today I can see your point.
> >
> > > You can get the equivilent of a C++ class with public interfaces and
> > > private members by making a seperate package for the class, and only
> > > exporting the public functions.
> >
> > Unfortunately, I haven't seen this advice elsewhere. A person coming
> > from a background in C++ or Java would want to hear advice like this
> > for reassurance that access control can be layered over CLOS, whether
> > or not it's idiomatic to do so.
>
> I think this will be a fairly easy sell, but I'm going to have a tougher
> time with the lack of destructors. My basic line on this will be:
>
> 1-reclamation of memory is handled automatically by the GC
> 2-reclamation of other system resources is problematic in a GC'd
> language and best handled with other methods
>
> Any additional thoughts?
Constructs like WITH-OPEN-FILE also handle many of the cases that
destructors are used for--to guarantee that certain resources such as
file handles are released before the exit of a block. And since they
are syntactically obvious they are arguably a much better way to
express what is really going on.
Also, as part of 2 you can point out that Java has no destructors. Of
course you might need to be prepared to field questions about the Lisp
equivalent of finalization (a bad idea as anything more than a backup
and actually implemented in a pretty busted way in Java) and (if your
audience is full of real Java weenies) the Reference classes which are
the new version of finalization that actually work. I'm not sure what
the Lispy equivalents are; certainly they are implementation
dependent.
-Peter
--
Peter Seibel peter@javamonkey.com
Lisp is the red pill. -- John Fraser, comp.lang.lisp
- Next message: Duane Rettig: "Re: More static type fun."
- Previous message: Peter Seibel: "Re: CLOS and C++"
- In reply to: Geoffrey Summerhayes: "Re: CLOS and C++"
- Next in thread: Roman Belenov: "Re: CLOS and C++"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|