ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> tcl-core
tcl-core
Re: [TCLCORE] Pre-CFV: TIP#257
by Daniel A. Steffen other posts by this author
May 6 2008 1:51PM messages near this date
Re: [TCLCORE] Pre-CFV: TIP#257 | Re: [TCLCORE] Pre-CFV: TIP#257
Hi Donal,

On 06/05/2008, at 14:55, Donal K. Fellows wrote:

>  Tomasz Kosiak wrote:
> >> From my understanding TIP#279 was created as there are problems  
> >> in implementing XOTcl on top TIP#257.
> 
>  Not as far as I can see.

one difference between TclOO and XOTcl that I've run into is the  
semantics of class destruction (c.f. script below).

TclOO currently destroys all subclasses and objects of a class when  
that class is destroyed, c.f. ReleaseClassContents().

XOTcl removes the destroyed class from the list of superclasses of  
its subclasses and resets the class of objects of the destroyed class  
to Object, c.f. <http://media.wu-wien.ac.at/doc/ 
tutorial.html#class_destroy> .

I have no opinion on which of those behaviours is better, indeed I  
can see uses for both, so I am wondering if you have thought about  
making class destruction configurable/pluggable in TclOO?

TIP257 does not appear to specify class destruction behaviour, so  
this is probably irrelevant for the vote (which I hope will be YES  
FWIW...)

Cheers,

Daniel

-- 
** Daniel A. Steffen                   **
** <mailto:das@[...].net>   **


#---------------------------------------------------------------
puts "TclOO:"
package require TclOO

##destruction logging:
oo::define oo::object destructor {puts "  [self] destroyed"}

oo::class create A {}
oo::class create B {superclass A}
puts " class  B with superclass [info class superclasses B]"
A create O
puts " object O of class [info object class O]"
puts "destroying A:"
A destroy
puts "B and O destroyed!"

#---------------------------------------------------------------
# TclOO:
#  class  B with superclass ::A
#  object O of class ::A
# destroying A:
#   ::A destroyed
#   ::B destroyed
#   ::O destroyed
# B and O destroyed!
#---------------------------------------------------------------

puts "\nXOTcl:"
package require XOTcl

##destruction logging:
xotcl::Class create L
L instproc instdestroy {obj}  {puts "  $obj destroyed"; xotcl::next}
xotcl::Class instmixin add L

xotcl::Class create A
xotcl::Class create B -superclass A
puts " class  B with superclass [B info superclass]"
A create O
puts " object O of class [O info class]"
puts "destroying A:"
A destroy
puts " class  B with superclass [B info superclass]"
puts " object O of class [O info class]"
puts "destroying B & O:"
B destroy; O destroy

xotcl::Class instmixin delete L

#---------------------------------------------------------------
# XOTcl:
#  class  B with superclass ::A
#  object O of class ::A
# destroying A:
#   ::A destroyed
#  class  B with superclass ::xotcl::Object
#  object O of class ::xotcl::Object
# destroying B & O:
#   ::B destroyed
#   ::O destroyed
#---------------------------------------------------------------


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Tcl-Core mailing list
Tcl-Core@[...].net
https://lists.sourceforge.net/lists/listinfo/tcl-core
Thread:
Twylite
Will Duquette
Kevin Kenny
Kevin Kenny
Will Duquette
Arnulf Wiedemann
Will Duquette
Kevin Kenny
Donal K. Fellows
Twylite
Larry W. Virden
Twylite
Gustaf Neumann
Larry McVoy
Gerald W. Lester
Vasiljevic Zoran
Larry McVoy
Gerald W. Lester
Larry McVoy
Tomasz Kosiak
Gustaf Neumann
Donal K. Fellows
Daniel A. Steffen
Donal K. Fellows
Daniel A. Steffen
Donal K. Fellows
Donal K. Fellows
Daniel A. Steffen
Gerald W. Lester
Vasiljevic Zoran
Arnulf Wiedemann
Tom Krehbiel
Vasiljevic Zoran
Donal K. Fellows
Gustaf Neumann
Brian Griffin
Gustaf Neumann
Donal K. Fellows
Gustaf Neumann
Kristoffer Lawson
Daniel A. Steffen
Twylite
Donal K. Fellows
Will Duquette
Donal K. Fellows
Will Duquette
Arnulf Wiedemann
dgp
Donal K. Fellows
Arnulf Wiedemann
Twylite
Will Duquette
Twylite
Donal K. Fellows
Stefan Sobernig
Donal K. Fellows
Stefan Sobernig

Privacy Policy | Email Opt-out | Feedback | Syndication
© 2004 ActiveState, a division of Sophos All rights reserved