XOTcl, is an object system implemented in the Next Scripting Framework and distributed along with it. The Next Scripting Framework in turn is the result of a refactorization of XOTcl, which up until version 1.6.7 did not use the Next Scripting Framework.
XOTcl is included in ActiveTcl and WinTclTk.
SYStems: Does anyone know where I can get recent Debian packages for XOTcl? Sarge doesn't have any XOTcl packages at all.
Zoran Vasiljevic says, "... it runs leak free, does not crash, obeys to what's written in the manual, is thread-safe, can be used under AOLserver or under Tcl threading extension w/o problems, is loaded with features., checked with Purify..."
We have written 100K lines in Xotcl and I find it very valuable. I like it more than [incr Tcl] since it ihas more of the dynamic nature of Tcl than [incr Tcl] does. The [incr Tcl] is more appealing to C++/Java programmers. Xotcl should be more appealing to Tcl programmers, IMHO."
XOTcl, short for Extended OTcl and pronounced "exotickle" or "X O Tee See El", provides a superset of MIT OTcl's features, with meta-classes, multiple inheritance and read/write introspection, XOTcl adds per-object mix-ins, filters, nested classes, dynamic object aggregations, metadata, and assertions. Together, these features allow easy construction of high-level patterns and structures and that follow the Tao of Tcl.
XOTcl combines the ideas of scripting and object-orientation in a way that preserves the benefits of both of them. It is equipped with several new language functions that help building and managing complex systems. It supports the following features:
Gustaf Neumann, XOTcl mailing list , 2003-07-20:
XOTcl is thread safe (see Thread-safe Tcl Extensions) and one of the fastest OO Tcl Extensions (see Tcl OO Bench).
GN: Preexisting aolserver applications can be extended with XOTcl; new ones can be written based on XOTcl. The OpenACS core group decided to use XOTcl as a requirement starting with 5.3. OpenACS support for XOTcl and several OpenACS packages can be obtained from the OpenACS cvs HEAD version.
DKF: The XOTcl Method Traversal Order is fairly complex and not especially well documented, and so merited its own page.
GN: Here is a summary of the invocation order of XOTcl:
Assertions are similar to the :before, :after, :around in CLOS, but all three types (as they are defined in current XOTcl) do not change the result of a method. Assertions, as we have these today, are specialized, but could be generalized to something more CLOS-like.
Finally, "unknown" is an exception handler, invoked in case the method to be dispatched is not defined by the classes in the precedence order or by the object. This means, a mixin containing a certain method can prevent that unknown is called.
Forwarders are c-implemented methods. They are pure convenience and could be implemented by the user as methods as well. If a class providing an forwarder to its instances is mixed in, the forwarders are mixed in as well.
Pre- and post-conditions can be implemented roughly with mixins, but they cannot measure the immediate effect of a single method call (mixins would implement the pre- and postconditions of an invocation of a next-chain). All tree types can however be implemented by filters (which can alter results). It would be quite slow, and give no nice error traces. It will be some work, but it should be possible. It is hard to say, what on this level cannot done with filters.
XOTcl Introductory Example: shows how XOTcl diffes from, e.g., itcl by providing "open class definitions", object-specific behavior and mixin classes (among other things) to achieve a more dynamic behaviour.
XOTcl Objects as Tcl Commands with subcommands:
chan command in XOTcl: Cacheable class: shows how filters can be used to build a transparent cache for specified methods. Because of the nature of XOTcl this can be dynamically mixed into objects and their class hierarchies and later removed when not necessary.
Safe XOTcl object creation: There are some 'gotchas' in object instantiation with XOTcl. Here is code snippet to make things cosy and safe.
Category XOTcl Code: more code examples
NEM 2004-04-18: I guess a question which comes up with any object system eventually is "has anyone written a mega-widget framework with this yet?" It seems to me that XOTcl is a pretty powerful object system, and so could probably form the basis of a very nice widget framework. Has anyone done any experiments in this direction? How would you go about it? Create a new meta-class type construct (Widget or something like that)? Doing something like this as an exercise might be a useful way to show off some of the more powerful features of XOTcl, and how they can be used to good effect.
Artur Trzewik 2004-04-19: There are pretty many GUIStuff in XOTclIDE in component IDEBaseGUI. It is not complete GUI Framework but some special classes that offer OO way to use Tk. For example Menu-Framework that can control automatic menu enablement and same time pop-up menus. Also
Indeed XOTcl works pretty well with other widget frameworks. I have used Tix and BWidget without problems. Even ITk is possible (but not tested be myself).
WHD 2004-04-23: Artur, I think you're describing a collection of widget-like objects written in XOTcl; what Neil was asking about was a straightforward means of creating new widgets in XOTcl, rather like snit::widgets which work like and interoperate with Tk widgets. So let me ask the question a different way: Using XOTcl, is it possible to create an object that looks and acts like a Tk widget?
Artur Trzewik 2004-04-23: Yes, it is possible to create Tk-like widgets with XOTcl (the same do Tix or ITk). But you not really want it. Because Tk is not realy OO (it has some OO characteristic because options by some widget has the same name).
You can not build a child class of the button or text Tk widgets, but it is a base technique for OO widget set. Therefore really OO widget set would wrap Tk widget and not build some new Tk-like widget.
XOTcl widget set should be more like WinForms from .NET, Qt, or Java Swing. For example with XOTcl is possible to use more program techniques than Tk offers. One problem of adapting Tk to OO is lack of events (Publisher-Subscriber Model) that is useful for implementing Model View Controller Pattern. In this case you must wrap Tk in XOTcl-Classes and program it yourself. Other tasks were: Validators, Buffering, Building from XML.
Some techniques of using Tk in XOTcl were also discussed in XOTcl mailings; see the XOTcl mailing list (I do not remember the month, June 2004 probably) [L2 ]
The question is what to you want achieve with XOTcl widget set.
For me Tk is good base widget set. But in OO-Application you will rather wrap them in your classes and adapt them to your OO-use specific for your application. The advantage of XOTcl is not the possibility to build new Tk-Widgets but rather use them in OO-manner.
Sarnold: What about snit emulation with Xoins? It already supports snit::widget emulation (non-surprisingly named xoins::widget), and the current release (O.5p1) handles also widgetadaptors. It is, being build on the top of XOTcl, faster than snit, especially at instantiation.
Strick 2004-01-11: Does anyone have hints on using XOTcl in a safe interpreter? It doesn't have a Xotcl_SafeInit(), so you can't load it. Aliasing it from a full interpreter is a bad idea: "Object eval" would give you access to the full interpreter. It looks like I'll have to do surgery on the sources? The paper, Semantic lookup in service-oriented architectures , U. Zdun, 2004, makes me think it's been done before.
SRIV: In response to Artur's comment "Yes it is possible to create Tk-like widgets with XOTcl, but you not really want it." ... I want it. For Tk to gain momentum, it needs to be extensible. Using any other paradigm because you feel it is superior is just unacceptable.
RLH: "For Tk to gain momentum" - exactly what do you think that means? Tk has been around a long time and while other "dynamic" languages use Tk the more popular ones are moving to other toolkits. Python has Tkinter but wxPython is preferred (a book is in the works as well), Ruby has Tk but most use either Fox Toolkit or wx again. Perl uses Tk but I see wxPerl coming up now and when it gets a bit more mature and a bit more exposure I see that becoming the toolkit there as well. Now it is possible that Tile will be able to move some back to using Tk but I don't see a mass migration back to Tk because of it.
SRIV You answered your own question.
RLH I rambled yes.