<br><div><span class="gmail_quote">On 6/13/07, <b class="gmail_sendername">Jens Axel Søgaard</b> <<a href="mailto:firstname.lastname@example.org">email@example.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>> The problem here is not that it is a complex object, but that<br>> structure definitions are generative - it would have worked<br>> if you used vectors. Back to the structure problem. To quote the<br>> documentation:
<br><br>> "Each time a define-struct expression is evaluated, a new structure<br>> type is created with distinct constructor, predicate, accessor, and<br>> mutator procedures."</blockquote><div>
<br>Thanks for the great explanation Jens - this makes great sense - but is there a way to prevent struct being evaluated twice, once for (require) and once for (require-for-syntax)? In the example you cited the double eval is clearly intended because each define-struct is enclosed lexcially and it makes sense that they are different structs (like enclosed lambda & variables are different), but IMHO (require-for-syntax) and (require) evaluate the same code twice is _surprising_ (I thought it's more like "importing" names to the transformation environment) - love to hear your and others' take on whether this is expected.
<br></div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">One solution is to calculate the values at expansion time, and<br>then expand to (create-foo val1 ...).
</blockquote><div><br>This is how I currently have it (but my code have multiple nested struct creations, which makes it difficult to fully leverage expansion time) - until I thought - why not try to see if the object(s) can be generated in compile time and return to run time... close but not quite :)
<br><br>Very appreciated! ;) Thanks,<br>yc<br><br></div></div>