[racket-dev] Racket on Rockets

From: Carl Eastlund (cce at ccs.neu.edu)
Date: Wed Jul 27 16:21:18 EDT 2011

On Wed, Jul 27, 2011 at 4:17 PM, Sam Tobin-Hochstadt <samth at ccs.neu.edu> wrote:
> On Wed, Jul 27, 2011 at 1:10 PM, Tony Garnock-Jones <tonyg at ccs.neu.edu> wrote:
>> On 2011-07-27 4:01 PM, Sam Tobin-Hochstadt wrote:
>>> If you have a sufficiently powerful inspector, you can traverse any
>>> structure.  In principle, you can even traverse closures this way, but
>>> no inspector with the needed power exists.  See `struct->vector'.
>>
>> That sounds fantastic! Especially the traversal of closures. What kinds
>> of dark alchemy would I have to engage in to get hold of the necessary
>> inspector?
>
> No such alchemy exists, it's just intended as part of the conceptual framework.
>
>> Would such an inspector be able to represent the structure of chaperoned
>> and impersonated values accurately?
>
> No, `struct->vector' uses the chaperoned accessors, but doesn't
> represent their structure.
>
>> Finally, what about the other direction? I notice there's no obvious
>> `vector->struct`. Is there a general way of moving from the description
>> of a structure to the structure itself?
>
> No.

There is struct-type-make-constructor; if you have the inspector for
the structure, you can get at its structure type as well.

--Carl



Posted on the dev mailing list.