View · Search · Index
No registered users in community xowiki
in last 10 minutes

[Xotcl] serializer bug: searchDefaults

From: Stefan Sobernig <stefan.sobernig_at_wu-wien.ac.at>
Date: Wed, 03 Oct 2007 11:43:25 +0200

I just stumbled over buggy behaviour of
the XOTcl Serializer with respect to inheritance
relationships and searchDefaults, originally encountered
under AOLServer.

% info patchlevel
8.4.14
% set ::xotcl::version
1.5
% set ::xotcl::patchlevel
.4

I could also re-produce this behaviour with
the most recent xotcl release, 1.5.5 (as there
were no changes to the serializer between 1.5.4 and
1.5.5, I assume)

The snippet attached can be used to reproduce
this behaviour in a non-AOLServer environment.
Interesting enough, the critical part
is to create an instance of the super class BEFORE
declaring the sub class. Commenting the line
"Super create super" yields a sound stream, creating
super yields a broken one.

To reproduce, do the following:
tclsh searchDefaults.xotcl
tclsh /tmp/stream

I tried to have a more thorough look but
I couldn't illuminate myself ...

//stefan
-- 
Stefan Sobernig
Institute of Information Systems and New Media
Vienna University of Economics	
Augasse 2-6
A - 1090 Vienna
`- +43 - 1 - 31336 - 4878 [phone]
`- +43 - 1 - 31336 - 746 [fax]
`- stefan.sobernig_at_wu-wien.ac.at <mailto:stefan.sobernig_at_wu-wien.ac.at>
`- ss_at_thinkersfoot.net <mailto:ss_at_thinkersfoot.net>


package req XOTcl
package req xotcl::serializer
namespace import ::xotcl::*


Class Super -slots {
  Attribute attribute -default "some_default_value"
}

# !!! critical !!!
Super create super
# !!!!!!!!!!!!!!!!

Class Sub -superclass Super
Sub create sub -attribute "some_new_value"

set stream [::Serializer all]
set f [open /tmp/stream w]
puts $f {
  package req XOTcl
}
puts $f $stream
catch {close $f}