[plt-scheme] Porting to R6RS -- define-struct
You have to import define-struct and to export all variables defined by the
define-struct form.
Or sticking to R6RS: import (rnrs records syntactic (6)), use
define-record-type and export all variables defined by define-record-type.
Jos
----- Original Message -----
From: "Jon Simons" <simonsj at ccs.neu.edu>
To: <plt-scheme at list.cs.brown.edu>
Sent: Tuesday, July 01, 2008 11:16 AM
Subject: [plt-scheme] Porting to R6RS -- define-struct
> Hello,
>
> I am trying to port a pet project of mine from something that works with
> mzscheme v372 to be R6RS-compliant. My project had a few modules in
> different files within a local directory, and my top level file had a
> series of:
>
> (require (lib "list.ss"))
> (require "foo.scm") ;; local module
> (require "bar.scm") ;; local module
> ...
>
> So far I've managed to accomplish:
>
> #!r6rs
> (import (rnrs)
> (foo))
> ...
>
> Where my 'foo' module used to be:
>
> (module foo mzscheme
> (require (lib "list.ss"))
> (provide foo-func))
>
> And is now:
>
> #!r6rs
> (library (foo)
> (export foo-func)
> (import (rnrs)
> (rnrs lists (6)))
>
> #| foo-func definition |#)
>
> So far, so good... I used 'plt-r6rs --install ./foo.scm' to install my
> local file as an R6RS library. Is this the proper thing to do, even if
> this module is solely intended for use within my program?
>
> Now onto my 'bar' module. This module uses define-struct, and I currently
> have something like:
>
> #!r6rs
> (library (bar)
> (export BAR)
> (import)
>
> (define-struct BAR (a b c)))
>
> This yields "export: no binding for exported identifier in: BAR". I'm
> guessing that I need to import something to make define-struct available
> so that it can provide the BAR identifier.
>
> My question is -- how do I make this "work" ? Is define-struct available
> in an R6RS-friendly manner?
>
>
> --
> Jon Simons
> _________________________________________________
> For list-related administrative tasks:
> http://list.cs.brown.edu/mailman/listinfo/plt-scheme