[racket] help about a macro that uses a struct define with "make-struct-type"

From: Carl Eastlund (cce at ccs.neu.edu)
Date: Fri Jul 29 17:26:18 EDT 2011

On Fri, Jul 29, 2011 at 4:55 PM, Maurizio Giordano
<maurizio.giorda at gmail.com> wrote:
> In my new language implementation the mset
> is a fundamental data structure, I cannot rely only on standard
> syntax objects like lists, strings, etc.

If by that, you mean you want msets to have a printed representation
that can used in code (say, for quoted data) and also used with
Racket's read and write functions, then I see your problem -- we don't
really have good facilities for introducing new, phase-crossing
datatypes.  Racket relies on having a few core datatypes that all
phases share (e.g. lists, strings, symbols, etc.), but anything
implemented in Racket itself lives in only one phase.

If, on the other hand, you are not relying directly on Racket's
bindings for quote, quasiquote, read, or write, you may be able to
work around this.  For instance, you could use a read-syntax that
turns mset literals into a prefab struct that your quote form
interprets.  You could also have separate read and write functions
that interpret mset literals directly.  Basically, the less
Racket-like your language is, the more you have flexibility to work
around our read/write behavior across phases.


Posted on the users mailing list.