<div dir="ltr">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...)?</div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Tue, Jul 29, 2014 at 4:39 PM, J. Ian Johnson <span dir="ltr"><<a href="mailto:ianj@ccs.neu.edu" target="_blank">ianj@ccs.neu.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
>From the struct docs:<br>
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.<br>
<br>
You don't give anything to the constructor for #:auto fields.<br>
-Ian<br>
<div><div class="h5">----- Original Message -----<br>
From: "Spencer Florence" <<a href="mailto:florence@northwestern.edu">florence@northwestern.edu</a>><br>
To: "racket" <<a href="mailto:users@racket-lang.org">users@racket-lang.org</a>><br>
Sent: Tuesday, July 29, 2014 5:32:46 PM GMT -05:00 US/Canada Eastern<br>
Subject: [racket] Shared and structs with #:auto<br>
<br>
<br>
<br>
Hi all,<br>
<br>
I'm trying to use shared with a structure that has a field with #:auto<br>
<br>
If I have some structure like this:<br>
<br>
<br>
(struct test ([a #:auto]) #:transparent #:mutable)<br>
<br>
<br>
<br>
this works fine:<br>
<br>
<br>
(shared ([b (test)]) b)<br>
<br>
<br>
but this errors:<br>
<br>
<br>
(shared ([b (test 1)]) b)<br>
<br>
with "shared: wrong argument count for structure constructor; expected 0, found 1 in: (test1 1)"<br>
<br>
<br>
Is this a bug? Is there a work around?<br>
<br>
--Spencer<br>
</div></div>____________________<br>
Racket Users list:<br>
<a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
</blockquote></div><br></div>