[Xotcl] Serializer "bug"

MichaelL at frogware.com MichaelL at frogware.com
Wed Sep 17 16:08:58 CEST 2003


No, that didn't work. I verified that a) my code with the qualified name 
worked and b) if I removed the qualification it didn't work and c) if I 
added your change it still didn't work.

With some effort I can strip down my code to just give you the essentials. 
For what it's worth, here are the first few lines of the broken serialized 
file:

        ::Collection create ::agenda::items -noinit -array set __autonames 
{Item 11} 
        ::Collection create ::agenda::categories -noinit -array set 
__autonames {Category 2} 
        ::mulAgenda::Agenda create ::agenda -noinit 
        ::Collection create ::agenda::views -noinit -array set __autonames 
{View 1} 
        ...

You can see that lines 1 and 2 are creating objects that are aggregated 
inside ::agenda--but ::agenda isn't created until line 3. If I fully 
qualify the name I get what you'd expect:

        ::mulAgenda::Agenda create ::agenda -noinit 
        ::Collection create ::agenda::items -noinit -array set __autonames 
{Item 11} 
        ::Collection create ::agenda::categories -noinit -array set 
__autonames {Category 2} 
        ::Collection create ::agenda::views -noinit -array set __autonames 
{View 1} 
        ...

However, Michael Schlenker's idea worked. I changed this:

        Serializer instproc deepSerialize o {
                my serializeList [my allChildren $o]
        }

to this:

        Serializer instproc deepSerialize o {
                my serializeList [my allChildren [namespace which $o]]
        }

Would such a change be required anywhere else?

Uwe Zdun <uwe.zdun at wu-wien.ac.at> wrote on 09/17/2003 04:44:00 AM:

> This is rather an unexpected behavior than a bug ... 
> I think it would be ok, to force a full name for serialize and 
> deepSerialize,
> that is, change the method in Serializer.xotcl to:
> 
> Serializer instproc serialize {objectOrClass} {
>     my [my category $objectOrClass]-serialize [$objectOrClass]
> }
> 
> can you please check whether that would work in your example?
> 
> --uwe
> 




More information about the Xotcl mailing list