swarm-support
[Top][All Lists]
Advanced

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

Re: subclassing sets


From: Marcus G. Daniels
Subject: Re: subclassing sets
Date: 24 Jun 1999 12:55:56 -0700
User-agent: Gnus/5.070084 (Pterodactyl Gnus v0.84) Emacs/20.3.10

>>>>> "JI" == Jonathan Impett <address@hidden> writes:

JI> I was looking at an exchange from a couple of years ago
JI> suggesting that subclassing sets (and collections in general) was
JI> not a wise strategy. Is that still the case, can anyone tell me?

It's the same situation.

Subclassing requires some extra steps.  The extra steps are to
maintain some synthetic type objects that describe the implementations.
of the module protocols.

The idea behind this stuff was to set things up in such a way that
the user would be presented with type objects, and that these type
objects would provide implementations for the methods described by the
protocols in the module description file *but without revealing* any
particular Objective C class to the user. 

The eventual goal of the conventions below was to facilitate a
capability called method combination.  Method combination is a way to
build up an interface method by method from many different sources
(like multiple inheritance, but at the method level).  It's a powerful
idea, and it has practical applications in complexity studies.  For
example, if you wanted an agent to evolve a repertoire of behaviors
from `stuff' in the environment, method combination would be a nice
way to handle the genotype -> phenotype mapping.

Since then, we have come up with better ideas on how to implement
method combination, but it isn't a high priority.

Anyway:

  1.  Create a protocol file.  Use "CREATING" and "USING" to delineate
      the methods used at create time from those used only after createEnd.

  2.  Set up your makefile to run this:

mymodule.xm: mymodule.h
        OBJECTS="object1.o object2.o" sh makeh2x mymodule.xm
        test -d mymodule || mkdir mymodule
        mv mymodule.xt mymodule/types.h
        mv mymodule.xc mymodule/classes.h

  3.  Create a module initialization file, e.g, "mymodule.m".  This
      file should include mymodule.h and mymodule.xm and implement
      two functions:
  
      a. _mymodule_implement, which makes calls like this:

        [id_MyClass1_c setTypeImplemented: MyClass];
    
      b. _mymodule_initialize, which doesn't need to do anything.
     
      (Then add a rule to your makefile to compile mymodule.m.)


                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

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