[plt-scheme] flavoured modules

From: Jos Koot (jos.koot at telefonica.net)
Date: Thu Jul 19 03:58:21 EDT 2007

Hi,
A question: Consider two modules like
         
(module flavour-A mzscheme
       
 some flavour-A specific definitions defining a representation
 
 a longer text defining and providing a number of representation independent procedures using the representation)

Idem for representation B with exactly the same
representation independent part.

In order to avoid duplication of the
representation independent part,
i did the following:

(module representation-independent mzscheme
 (define-syntax representation-independent
  (syntax-rules ()
   ((_ all identifiers defining the representation)
    (begin
     representation independent code)))))

(module flavout-A mzscheme
 (require representation-independent)
 representation definitions
 (representation-independent
  all identifiers defining the representation))

Same for flavour B representation

This works allright. However, a disadvantage is that in module representation-indepenent the check-syntax tool cannot give much information because all code is in a template. Is there a smarter way to accomplish my goal? I rather like to avoid going back to units.
Best wishes, Jos koot.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20070719/12b316ff/attachment.html>

Posted on the users mailing list.