[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Anomalous results from is-a? and instance? on current-input-port
From: |
Mikael Djurfeldt |
Subject: |
Re: Anomalous results from is-a? and instance? on current-input-port |
Date: |
Wed, 16 Feb 2005 13:40:58 +0100 |
On Wed, 16 Feb 2005 06:55:44 -0500, Alan Grover <address@hidden> wrote:
> It's confusing to have an "object" with class, superclasses, etc., but
> not be "an instance". Since "class-of" returns a value (the Goops
> class), that implies it is a Goops instance.
Well, ideally every item of data would be a true instance, but that is
difficult to achieve. Historically, neither Scheme nor Guile was
object oriented. GOOPS is an add-on. The reason why all data in Guile
has an explicit representation of its type in terms of a class is to
enable specialization of generic functions to the data. I think the
cost in terms of confusion is payed back by the utility.
I know from my own experience that it is extremely limiting not to be
able to specialize generic functions to strings, numbers etc.
> What would be the predicate for determining that something is an
> instance of a class, capable of the introspection procedures, works with
> specialization by inheritance, but not a Goops object?
I'm not aware of any such object. Objects that can be introspected
using GOOPS introspection procedures, such as slot-ref, *are* GOOPS
objects. Instance? would be the predicate to use to test for that. The
only GOOPS:y thing you can do with an input-port is to ask for its
class (which also implies that you can specialize generic functions to
that class). The fact that instance? returns #f informs you that it
isn't a normal GOOPS object, doesn't have slots etc.
M