guile-devel
[Top][All Lists]
Advanced

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

Re: anyone define port types?


From: Marko Rauhamaa
Subject: Re: anyone define port types?
Date: Fri, 01 Apr 2016 01:28:15 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Jan Wedekind <address@hidden>:

> On Thu, 31 Mar 2016, Marko Rauhamaa wrote:
>> (get-x) is only a fig leaf for (slot-ref). In general, no user of an
>> <a> object should think the object holds a piece of information
>> called x. Instead, you should be interacting with the abstract object
>> <a>.
>
> Well, actually (get-x) is a generic as well. I.e. it is polymorphic
> and does not have to be a simple accessor for a slot.

Naturally, that's not my point.

In practice, GOOPS can be used just like any classic object system.
However,

 * The (make)/(initialize) mechanism is strongly tied to the slots.
   There is a strong temptation to define a nongeneric constructor
   function for each class that internally calls (make) with appropriate
   slot settings. This is suggested at the bottom of <URL: https://www.gn
   u.org/software/guile/manual/html_node/Slot-Description-Example.html#Sl
   ot-Description-Example>.

   Unfortunately, the separate constructor can't invoke a base class's
   constructor function but must contend with (make), which exposes the
   base class's slots to the derived class.

   Ideally, you should be able to interpret the keyword args to
   (make)/(initialize) independently of the slots. However, the
   (next-method) mechanism makes this tricky.

 * The (self <class>) notation makes code look very un-Schemey and
   noisy. For example, classic port dispatching is handled with the
   assumption that the port knows its methods.

 * The slot emphasis permeates the documentation and available
   facilities. The long <my-complex> is advertised as "a better
   solution" even though it is extremely noisy and complex numbers are
   extremely passive as objects (<URL: https://www.gnu.org/software/gui
   le/manual/html_node/Slot-Description-Example.html#Slot-Description-E
   xample>).

   What on earth are (shallow-clone) and (deep-clone) supposed to
   accomplish? Duplicate the database? Open another session to the
   server?


Marko



reply via email to

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