Search code examples
chicken-scheme

How to export interface with CHICKEN Scheme?


The documentation is not clear on how to use an interface from one unit into another.

I have the following unit a.scm:

(declare (unit a))

(define-interface polite
  (say-hello))

and the following unit b.scm:

(declare (uses a))

(module foo (interface: polite) ...)

When building b.scm, csc complains about knowing about polite:

Warning: reference to possibly unbound identifier `polite'

Solution

  • Ok so I don't know whether it's the best way to do it, but I put my interface into its own file that I include every time I need it. So in my case it's:

    In polite.scm:

    (define-interface polite
      (say-hello))
    

    In b.scm:

    (declare (unit b))
    (include "polite.scm")
    
    (module foo (interface: polite) ...)