Re: class definition dependencies

From: Ian Wild <ian.wild_at_eurocontrol.be>
Date: Mon, 22 Feb 1999 09:17:00 +0100

Brian Denheyer wrote:
>
> Let's says I have classes A & B :
>
> File A
> (define-class <class-a> () ...)
> (define-method foo ((a <class-a>) (b <class-b>)) ...)
>
> File B
> (define-class <class-b> () ...)
> (define-method foo ((a <class-a>) (b <class-b>)) ...)
>
> Oops. If A does (require "B") everything is OK. If B then does
> (require "A"), I have a cycle and stk gets upset (rightly so).
>
> It looks to me like I must put the class definitions into A and B and
> then create a 3rd file C which holds the method definitions. Does
> this make sense or am I missing something ?


Try this:

;;; File A
(provide "A")
(require "B")

(define...


;;; File B
(provide "B")
(require "A")

(define ...


This looks nice, in that the top of the file
tells me first what's provided, then trivial
implementation details, like what's required.

And it breaks the cycle.
Received on Mon Feb 22 1999 - 09:17:01 CET

This archive was generated by hypermail 2.3.0 : Mon Jul 21 2014 - 19:38:59 CEST