Outdated egg!

This is an egg for CHICKEN 3, the unsupported old release. You're almost certainly looking for the CHICKEN 4 version of this egg, if it exists.

If it does not exist, there may be equivalent functionality provided by another egg; have a look at the egg index. Otherwise, please consider porting this egg to the current version of CHICKEN.

c3

  1. Outdated egg!
  2. c3
    1. Description
    2. Author
    3. Requirements
    4. Download
    5. Documentation
    6. Examples
    7. Changelog
    8. License

Description

Implements C3 class linearization for TinyCLOS. For more information, see: http://www.webcom.com/~haahr/dylan/linearization-oopsla96.html and http://www.python.org/2.3/mro.html

Author

Alex Shinn

Requirements

The tinyclos egg.

Download

c3.egg

Documentation

To load:

 (use c3)

When loaded, all subsequent class definitions obey C3 linearization. It's not possible to switch back to the default, once it is active.

Examples

;; by Michele Simionato

(use c3)

(define O <object>)

;; first example
(define-class F (O) ())
(define-class E (O) ())
(define-class D (O) ())
(define-class C (D F) ())
(define-class B (D E) ())
(define-class A (B C) ())

; with CLOS:
(class-cpl A)
(A B C D F E object top)

; with C3:
(class-cpl A)
(A B C D E F object top) ; E <-> F
;; second example
(use c3)

(define-class F (O) ())
(define-class E (O) ())
(define-class D (O) ())
(define-class C (D F) ())
(define-class B (E D) ())
(define-class A (B C) ())

; with CLOS:
(class-cpl A)
(A B E C D F object top)

; with C3:
(class-cpl A)
(A B E C D F object top) ; identical
;; Pedroni's example
(use c3)

(define-class A(O) ())
(define-class B(O) ())
(define-class C(O) ())
(define-class D(O) ())
(define-class E(O) ())
(define-class K1(A B C) ())
(define-class K2(D B E) ())
(define-class K3(D A) ())
(define-class Z(K1 K2 K3) ())

; with CLOS:
(class-cpl Z)
(Z K1 K2 K3 D A B E C object top)

; with C3:
(class-cpl Z)
(Z K1 K2 K3 D A B C E object top) ; E <-> C

Changelog

License

 Copyright (c) 2004, Alex Shinn
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following
 conditions are met:
 
   Redistributions of source code must retain the above copyright notice, this list of conditions and the following
     disclaimer. 
   Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
     disclaimer in the documentation and/or other materials provided with the distribution. 
   Neither the name of the author nor the names of its contributors may be used to endorse or promote
     products derived from this software without specific prior written permission. 
 
 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
 OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
 AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 POSSIBILITY OF SUCH DAMAGE.