[racket] `immutable?` for `struct`s?

From: Carl Eastlund (carl.eastlund at gmail.com)
Date: Sat Jan 25 16:49:54 EST 2014

Greg,

You can use struct-info and struct-type-info to get at that information,
though it's a bit indirect -- you have to add together the numbers of
initialized and automatic fields, and compare that to the length of the
list of immutable field indices.  The reflective interface to structs is a
bit odd, mostly since it has been growing incrementally over time.

Carl Eastlund

On Sat, Jan 25, 2014 at 4:41 PM, Greg Hendershott <greghendershott at gmail.com
> wrote:

> I understand that, as its documentation clearly says, `immutable?` is
> not implemented for `struct`s. (In the sense that structs aren't on
> its special list: immutable? returns #f even for a struct that does
> not use #:mutable.)
>
> Is there some other way to check at runtime whether something that is
> struct? is mutable or not?
>
>
> p.s. The background for my question is an implementation of `egal?`:
> https://github.com/greghendershott/rackjure#egal
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20140125/ca790ae3/attachment.html>

Posted on the users mailing list.