''Sept 26, 2005'' See http://tip.tcl.tk/257 '''SUMMARY''' TIP #257 is a proposal to put a small-but-powerful object-oriented programming system into the [Tcl] core (for 8.5) where everyone will be able to rely on it. Its feature set is to be based mostly on [XOTcl], but with the addition of features for improved support for being the core of [Snit]. It should also be usable on its own. ---- '''IMPLEMENTATION NOTES''' [DKF] 19 Aug 2006: There is now a partially working version of the tip257 implementation for people to test out. It is at about the point where you can create an object, give it some methods, and run the methods. However, constructors, destructors and inheritance do not yet work. To get the source code, you need to check out the branch of CVS that I'm using for the development. You want to get from the usual tcl repository, but you want the branch ''tip-257-implementation-branch''. Thus, assuming you've just got anonCVS access, you do this (the anon password is empty in case you're wondering, and the second line is split): cvs -d:pserver:anonymous@tcl.cvs.sourceforge.net:/cvsroot/tcl login cvs -d:pserver:anonymous@tcl.cvs.sourceforge.net:/cvsroot/tcl -z9 co \ -r tip-257-implementation-branch -d tcl-and-tip257 tcl Building on both Unix and Win should be supported (no idea about OSX). There is a (small) test file in the Tcl test suite, oo.test. If you want to know to basically use the code, look there first as the code passes the test now. No proper docs yet; use the TIP itself there for the moment. Example session: % oo::object create foo ::foo % oo::define foo {method bar {} {puts "Hello, World!"}} % foo wrong # args: should be "foo method ?arg ...?" % foo ? unknown method "?": must be bar or destroy % foo bar Hello, World! % oo::define foo {method spong {} {my bar; next}} % foo spong Hello, World! no superclass method implementation % set errorInfo no superclass method implementation while executing "next" (method "spong" line 1) invoked from within "foo spong" [DKF] 20 Aug 2006: Constructors now work (but there's only one meaningful class to use them on). On the down side, now know that the [global] command doesn't work in methods and constructors properly... ''(now fixed)'' [DKF] 21 Aug 2006: Destructors, method forwarding (which used to crash), export and unexport now all added. There seems to be some kind of intermittent crash in the destructor code, probably due to memory not being managed quite right, but it doesn't crash on my home machine so tracking it down is slightly awkward. Export and unexport work, but won't work once we get inheritance in, especially in the MI case. Need to rethink how to implement them. :-( OK, the destructor crash has been pinned down as being due to destructors firing when the OO system as a whole is going away. That degree of cleanup isn't something I've attempted to do yet. [DKF] 23 Aug 2006: Single inheritance now working (or a good approximation of it; it's passing several tests). [RLH] Is it the intention then of only allowing single inheritance and not multiple to avoid the "diamond" effect of inheritance? Or is this just a step in that direction? [DKF] 24-25 Aug 2006: Multiple inheritance (diamond effects resolved using [XOTcl] rules) now working. Still got filters and mixins to do, but they're simple extensions of MI. (Does this answer your question, RLH? :-)) [RLH] Indeed it does. : ) [DKF] 26 Aug 2006: Most of object and class teardown now implemented. Memory leaks should be largely (but not yet completely) banished. [DKF] 27 Aug 2006: Teardown now done, allowing more of test suite to pass. Filters now supported on objects (not class-wide). [DKF] 28 Aug 2006: Per-object mixins and changing-an-object's-class now done. Mainly introspection facilities left in the C part of the development of this functionality. [RLH] You *are* sleeping I hope. : ) [DKF] 28 Aug 2006 (no, 29 Aug; it's late): Partial implementation of object cloning. Method cloning not working right, and class cloning completely wrong. (And I do this instead of watching television, which is why I have so much time.) [RLH] I haven't had television for 12 years now. : ) [DKF] 29 Aug 2006: Fixed crashes that were stopping the test suite from passing on Linux. They were caused by trying to run destructors in an interpreter which was cleaning up (a ''bad'' thing!), what happens when an object is deleted the "wrong way round" and the complex tangle of what happens when the object system core goes away. Thanks to [dgp] for helping me debug this. [DKF]: 30 Aug 2006: Added the start of the introspection facilities called for in the TIP. [DKF]: 31 Aug 2006: Non-class object cloning done. ---- '''DISCUSSION''' Moved to [TIP #257 Discussion]. ---- [[[Category Object Orientation]]]