<p dir="ltr">Yes, I had a copy/paste error in my previous message. The struct definition in the unit matches the one in the signature. I think that Daniel identified the core problem that the constructor is defined differently in #lang racket/signature.</p>
<p dir="ltr">Justin</p>
<div class="gmail_quote">On Feb 4, 2015 9:31 PM, "Matthias Felleisen" <<a href="mailto:matthias@ccs.neu.edu">matthias@ccs.neu.edu</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
This works:<br>
<br>
;; ---------------------------------------------------------<br>
#lang racket/signature  ;; b-sig.rkt<br>
<br>
(struct spelling-word (word sentence word-number lesson word-list))<br>
b-value<br>
<br>
;; ---------------------------------------------------------<br>
#lang racket/unit ;; b-unit.rkt<br>
<br>
(require "b-sig.rkt")<br>
<br>
(import)<br>
(export b^)<br>
<br>
(define-struct spelling-word (word sentence word-number lesson word-list))<br>
<br>
(define b-value 3)<br>
<br>
<br>
;; ---------------------------------------------------------<br>
The signature of a component (unit) describes the names of the exports<br>
(or imports). So when you write<br>
<br>
  (struct my-struct (a b c))<br>
<br>
in a signature, your exporting unit must define something like<br>
<br>
 (define-struct my-struct (a b c))<br>
<br>
[You can also use the struct syntax but you then need to define the alternative constructor.]<br>
<br>
;; ---------------------------------------------------------<br>
I recommend developing small units in one DrRacket buffer. It's the<br>
easiest way to get used to their syntax.<br>
<br>
-- Matthias<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
On Feb 4, 2015, at 9:14 PM, Justin Zamora wrote:<br>
<br>
> There seems to be a problem exporting struct constructors when using #lang racket/signature. This works:<br>
><br>
> ----- b-sig.rkt-----<br>
> #lang racket<br>
><br>
> (define-signature b^<br>
>   ((struct my-struct (a b c))<br>
>    b-value))<br>
><br>
> (provide b^)<br>
><br>
> ----- b-unit.rkt -----<br>
> #lang racket/unit<br>
><br>
> (require "b-sig.rkt")<br>
><br>
> (import)<br>
> (export b^)<br>
><br>
> (struct spelling-word<br>
>   (word sentence word-number lesson word-list))<br>
><br>
> (define b-value 3)<br>
><br>
> But if you change b-sig to use #lang racket/signature:<br>
> #lang racket/signature<br>
><br>
> (struct my-struct (a b c))<br>
> b-value<br>
><br>
> then running b-unit produces the error:<br>
><br>
> Welcome to DrRacket, version 6.1 [3m].<br>
> Language: racket/unit; memory limit: 512 MB.<br>
> define-unit: undefined export make-my-struct in: (define-unit b@ (import) (export b^) (struct my-struct (a b c)) (define b-value 3))<br>
><br>
> Is this a just a bug or am I missing something?<br>
><br>
> ____________________<br>
>  Racket Users list:<br>
>  <a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
<br>
</blockquote></div>