"Eduardo Cavazos" wrote:
> Something I've been wondering; have there been any
> experiments with Traits/Roles in Scheme?
If you mean associate additional infos to an identifier at
expand time, the only thing I know of is PLT's typed Scheme
and CLOS-like extension, which should do something like
that. IMHO the only way of adding informations to an
identifier in R6RS is to bind another identifier whose
symbol can be constructed from the first one; something
like:
(define thing ---)
(define thing-information-of ---)
and export both, which is what I am doing; there is the
constraint of keeping the symbols in pair when renaming at
import/export time, which is boring but simple: we know
exactly what we have to do.
I had thought of creating a syntax object and exporting it
from a library to allow peeking in the library with
DATUM->SYNTAX but I dunno if it can be made to work; let's
put aside for a moment the problems with phases and levels,
something like:
(library (things)
(export thing)
(import rnrs)
(define thing (syntax ---))
---)
(library (thongs)
(export)
(import (rnrs)
(for (things) expand run))
(define-syntax doit
(lambda (stx)
(define (%build-a-symbol ?it)
---)
(syntax-case stx ()
((_ ?it)
(with-syntax ((it (datum->syntax thing (%build-a-symbol #'?it))))
---)))))
)
should allow the (thongs) library to peek into the (things)
library and get values bound to non-exported identifiers. I
do not know if there exists a combination of libraries and
import levels which allows it...
--
Marco Maggi