[racket] shared and immutable structures
Just thinking out loud, but is there any way to use the unsafe operations to make the shared library work for immutable data? If you can prove it's actually safe, then there'd be no harm to users. (After all, as you say, that's what it's doing with pairs.)
Dave
On Feb 1, 2011, at 7:48 AM, David Van Horn wrote:
> On 2/1/11 10:39 AM, Stephen Chang wrote:
>> So why wouldnt using a mutable struct work?
>>
>>> (struct kons (first rest) #:transparent #:mutable)
>>> (shared ([a (kons 1 a)]) a)
>> #0=(kons 1 #0#)
>
> Yes, but that's what I was trying to avoid. My structure represents immutable cyclic data, so it's weird to make it mutable. Pairs are immutable and work with shared after all.
>
> Anyway, it's no big deal. I'll just make the structure mutable and move on.
>
> Thanks,
> David
> _________________________________________________
> For list-related administrative tasks:
> http://lists.racket-lang.org/listinfo/users