[Xotcl] possible bug?

Gustaf Neumann neumann at wu.ac.at
Mon Jan 10 22:54:24 CET 2011


Am 10.01.11 22:26, schrieb Artur Trzewik:
>  I suppose effect by redefining class
Artur, i had the same guess, since all
the files load fine as they are. Something
is missing in the picture.

But most probably, the problem is the redefinition
problem, where the standard redefining semantics
are a destroy followed by a create. When a class
is destroyed, the references to the class are deleted,
so a superclass relation (or similar) will get lost.

In this case, xotcl::configure softrecreate will help:

=========================================
namespace import xotcl::*
::xotcl::configure softrecreate true

Class F1
Class F2 -superclass F1
#
# Before 2nd create of F1
#
puts "F2 superclass [F2 info heritage]"
Class F1
#
# After 2nd create of F1
#
puts "F2 superclass [F2 info heritage]"
=========================================

Krzysztof, soucing your file extendedContainer.xotcl  and
creating an instance of ExtendedContainer works fine:

=========================================
~/scripts/krz% xotclsh
% source extendedContainer.xotcl
% ExtendedContainer x
Calling testB on class B object...
testB was called
...proc called successfully
Calling testA on class B object...
testA was called
...proc called successfully
::x
=========================================

btw, not sure that you are aware that you are creating
in several of your source files classes twice. E.g.
in extendedContainer.xotcl, you create the class
ExtendedContainer in line (2) and once again in
line (8).

-gustaf neumann

=======================================
1 package require XOTcl
2 xotcl::Class ExtendedContainer
3
4 namespace import xotcl::*
5 source b.xotcl
6
7
8 Class create ExtendedContainer
9
10 ExtendedContainer instproc init {} {
...
=======================================

-- 
Univ.Prof. Dr. Gustaf Neumann
Institute of Information Systems and New Media
WU Vienna
Augasse 2-6, A-1090 Vienna, AUSTRIA



More information about the Xotcl mailing list