This is the mail archive of the guile@cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: records


Chris Bitmead <chris@tech.com.au> writes:

>.However display is unlikely to have the same code for all types

It has.
 
scm_iprin1 (exp, port, pstate)
{
  switch (7 & (int) exp) {
    case 2:
    case 6:
      scm_intprint (SCM_INUM (exp), 10, port);

    case ... /* print a macro */

    case ... /* print a closure */
}

If display were polymorphic every object (macro, closure, int etc.)
would have a print function of its own.

Take a look at Meyer's book on page 1175: "Emulating inheritance
with genericity" where he describes that generic functions like scheme's
print function must emulate polymorphism by using a giant switch statement.

In contrast take a look at the implementation of smobs:  Every smob
has its own print function.  So the smob's print function is polymorphic.


My point was that polymorphism is superior to genericity. You can
easily emulate genericity by using polymorphism.  Unfortunately scheme
is functional language and the authors of scheme choose genericity in
favor of polymorphism.  

If think the problem is that when you want to introduce polymorphism
into guile you must first define an explicit type system.  

On the other hand you can't create a complete operating environment
just by using guile.  As I understand it guile should only be the glue
between objects and programs written in C and it should help objects
and programs written in C to parse and write their configuration
files.  So I think that every guile object would be (more or less) a
proxy object for a programm or object written in C.  


> I'm not sure that there is "standard OO terminology". 

I would say that Rumbaugh, Meyer, Booch and Jakobsen are the
authorities in the OO field.  UML is standard these days.

The same terminology is also used by Wirth, Stourstrup and others.
If you look at the latest book from Tom DeMarco you will see that he
also uses their terminology. :)


Jost

P.S.:  I've looked at the "OO FAQ".  Please BURN IT. :) It
seems do describe pseudo OO terms that were used 20 years ago.
For example genericity has *nothing* to do with the OO paradigm,
it is quite the opposite.

From my bibtex database:

@Book{Rumbaugh91,
  author =       "J. Rumbaugh and M. Blaha and W. Premerlani and F. Eddy
                 and W. Lorensen",
  title =        "Object-Oriented Modelling and Design",
  publisher =    "Prentice Hall",
  address =      "Englewood Cliffs",
  year =         "1991",
}

@Book{Reiser92,
  author =       "M. Reiser and N. Wirth",
  title =        "Programming in Oberon. Steps beyond Pascal and
                 Modula-2.",
  publisher =    "Addison-Wesley",
  year =         "1992",
  keywords =     "Oberon, programming language",
  abstract =     "from the refs in a paper",
}

@Book{Meyer92,
  author =       "Bertrand Meyer",
  title =        "Eiffel: the language",
  year =         1992,
  publisher =    "Prentice Hall",
  address =      "New York, NY",
  ISBN =         "0-13-247925-7",
  edition =      1

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]