[racket] Shared and structs with #:auto
Woops. I was under the impression that #:auto worked like an optional
argument. Is there any way to do optional constructor arguments with
structs (I don't see one but I can hope...)?
On Tue, Jul 29, 2014 at 4:39 PM, J. Ian Johnson <ianj at ccs.neu.edu> wrote:
> From the struct docs:
> constructor-id (which defaults to id), a constructor procedure that takes
> m arguments and returns a new instance of the structure type, where m is
> the number of fields that do not include an #:auto option.
>
> You don't give anything to the constructor for #:auto fields.
> -Ian
> ----- Original Message -----
> From: "Spencer Florence" <florence at northwestern.edu>
> To: "racket" <users at racket-lang.org>
> Sent: Tuesday, July 29, 2014 5:32:46 PM GMT -05:00 US/Canada Eastern
> Subject: [racket] Shared and structs with #:auto
>
>
>
> Hi all,
>
> I'm trying to use shared with a structure that has a field with #:auto
>
> If I have some structure like this:
>
>
> (struct test ([a #:auto]) #:transparent #:mutable)
>
>
>
> this works fine:
>
>
> (shared ([b (test)]) b)
>
>
> but this errors:
>
>
> (shared ([b (test 1)]) b)
>
> with "shared: wrong argument count for structure constructor; expected 0,
> found 1 in: (test1 1)"
>
>
> Is this a bug? Is there a work around?
>
> --Spencer
> ____________________
> Racket Users list:
> http://lists.racket-lang.org/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20140729/c37ec844/attachment.html>