[racket-dev] cstruct and properties
At Thu, 8 Nov 2012 15:20:33 +0100, Tobias Hammer wrote:
> On Thu, 08 Nov 2012 14:55:21 +0100, Matthew Flatt <mflatt at cs.utah.edu>
> wrote:
>
> [ ... ]
> > It's interesting that you can make that work in the current
> > implementation, but I worry about guaranteeing that order for the
> > future. I'm inclined instead to say that the above declaration should
> > have signaled an error due to an too-early use of `_S', just like
> >
> > (struct a () #:property prop:procedure struct:a)
> >
> > The repair to `define-cstruct', then, would be to lift the property and
> > property-value expressions out of the nested scope where they currently
> > are evaluated.
> >
> > Is it important for your purposes that the `define-cstruct' declaration
> > above works? Or could you use a thunk to delay reference, as in
> >
> > (define-cstruct _S ([a (_array _byte 23)])
> > #:property p (lambda () _S))
> >
> > ?
>
> That was a possibility i also tried, but with the same erroneous result.
Yes, it's broken right now. But would it be good enough if we made that
work (as opposed to making the variant without the thunk wrapper),
which I think would be consistent with other forms?