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 <[email protected]> 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" <[email protected]>
> To: "racket" <[email protected]>
> 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
>
____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Reply via email to