[plt-scheme] Bug in interaction between shared and class system?

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Tue Dec 29 10:22:03 EST 2009

Well, it is a bit magical. And you'd be right to wonder why there
isn't a better error message (and perhaps even why it doesn't work for
class fields). I'm not sure of the best answers there, but probably it
could be better than what it is.

Robby

On Tue, Dec 29, 2009 at 8:30 AM, Todd O'Bryan <toddobryan at gmail.com> wrote:
> Thanks. I should have read more carefully. I was just assuming it was
> magic... :-)
>
> On Tue, Dec 29, 2009 at 9:15 AM, Robby Findler
> <robby at eecs.northwestern.edu> wrote:
>> No, that doesn't work. The docs for scheme/shared give a precise spec
>> of what will work.
>>
>> Robby
>>
>> On Tue, Dec 29, 2009 at 7:47 AM, Todd O'Bryan <toddobryan at gmail.com> wrote:
>>> #lang scheme
>>>
>>> (define Node%
>>>  (class object%
>>>    (init-field value
>>>                next)
>>>
>>>    (super-new)))
>>>
>>> (define cycle
>>>  (shared ([the-node (new Node% [value "abc"] [next the-node])])
>>>    the-node))
>>> ------------------------
>>> If I'm using shared correctly, that should create a Node% that refers
>>> back to itself.
>>>
>>> cycle really is a Node%:
>>>
>>>> cycle
>>> #(struct:object:Node% ...)
>>>
>>> but its next didn't get set correctly.
>>>
>>>> (get-field next cycle)
>>> #<undefined>
>>>
>>> Is this a bug, or am I not allowed to do this?
>>> Todd
>>> _________________________________________________
>>>  For list-related administrative tasks:
>>>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>>>
>>
>


Posted on the users mailing list.