swarm-support
[Top][All Lists]
Advanced

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

Re: subclassing/collections


From: Roger Burkhart
Subject: Re: subclassing/collections
Date: Fri, 14 Jun 96 09:40:49 MDT

> I am aware of the warning that subclassing from collections is not
> supported. Nevertheless I derived a network class from Linked_list similar
> to the grid turtle program grid2.m. It used to work fine. Now with the
> latest changes in Swarm it is quite a mess. I receive error messages that
> it does not find interface declarations for List_linked nor for List_mlinks
> depending on how I try to implement it.

I'm don't know why it would have stopped working.  The example in
grid2.m, which inherits from List_linked, is still there and still
compiles and runs OK.  (The grid directory is currently distributed as
part of the documentation release, with an overview page of the
programs accessible from the "Documentation and Implementation Status"
link of the collections and activity library pages.)

There aren't any recent changes that occur to me that would have
changed this.  As a first step maybe you could check whether you've got
the same basic setup as grid2.m.  Check in particular that you're
importing the <collections/List_linked.h> header file where the
interface declaration should be found.
 
> Any suggestions how I should change the whole class structure which
> unfortunately uses as superclass List_linked. You recommend to import the
> collections and use an instance. Is this the most reasonable solution which
> should be robust to further changes in the SWARM architecture?

If you can get the inheritance from the internal implementation class
(List_linked) to work, feel free to use it, just be aware that there could
be changes.  Even though subclassing from collection implementations isn't
currently officially supported, there are legitimate needs for this and we'll
provide a more formally supported subclassing interface after the collections
implementation has been revamped (currently in progress).

If you do just create a collection and put it in your own instance
variables, then yes, that is the most robust to further changes in the
Swarm architecture, since then you're just using the collection as an
ordinary calling client.  The major loss is that you don't automatically
get all the messages of the collection on your own object, but instead
have to code your own methods to pass through messages on your object
to the object in the instance variable.  But it's often better to be
selective about the messages you externalize for your own object,
anyway.


reply via email to

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