[plt-scheme] (provide ...) question

From: Todd O'Bryan (toddobryan at gmail.com)
Date: Tue May 18 10:03:33 EDT 2010

Whoops. I tried to simplify the example, and simplified it to the
point where it works. It seems that the problem is actually when I try
to use define-struct/contract:

#lang scheme
(provide (except-out (struct-out city-line)
                    make-city-line)
        (rename-out [better-make-city-line make-city-line]))

(define-struct/contract city-line
  ([city string?]
   [state #px"[A-Z]{2}"]
   [zip #px"\\d{5}"]
   [zip+4 #px"\\d{4}"]))

(define better-make-city-line
 (case-lambda
   [(city state zip zip+4)
    (make-city-line city state zip zip+4)]
   [(city state zip)
    (make-city-line city state zip "")]))

causes the error:

except-out: identifier to remove `make-city-line' not included in
nested provide spec in: (struct-out city-line)

Sorry for not checking my example!
Todd

On Tue, May 18, 2010 at 9:43 AM, Matthias Felleisen
<matthias at ccs.neu.edu> wrote:
>
> In what way doesn't this do "it"?
>
>
> On May 18, 2010, at 8:44 AM, Todd O'Bryan wrote:
>
>> I have a struct that I'd like to provide from a module, but I'd like
>> to provide a different constructor to modules that require it. Here's
>> a simple example:
>>
>> (define-struct city-line (city state zip zip+4))
>>
>> (define better-make-city-line
>>  (case-lambda
>>   [(city state zip zip+4)
>>    (make-city-line city state zip zip+4)]
>>   [(city state zip)
>>    (make-city-line city state zip "")]))
>>
>> I tried this:
>>
>> (provide (except-out (struct-out city-line)
>>                    make-city-line)
>>        (rename-out [better-make-city-line make-city-line]))
>>
>> but that doesn't seem to do it.
>>
>> Is there a way to do such a thing? Am I close?
>>
>> Thanks,
>> Todd
>> _________________________________________________
>>  For list-related administrative tasks:
>>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>
>


Posted on the users mailing list.