The [TCL Architecture of Objects] Not to be confused with Tao (S), the ever changing state of the Universe, [The Tao of Tcl], or The Ace Orb (TAO) [http://www.cs.wustl.edu/~schmidt/TAO.html], which uses a feather icon on their web site. '''Quick Links''' * Main Website/Fossil repository/Wiki http:/fossil.etoyoc.com/fossil/taolib%|%http:/fossil.etoyoc.com/fossil/taolib%|% '''Tao Modules''' Each of the modules is packaged as a [tarball] that can be unpacked into your [auto_path]. They are self-contained with a copy of the core and all supporting libraries (save the biggies like tcllib). Tao's only external requirements are sqlite3 * tao - The main parser and core classes * taotk - A megawidget system based on Tao objects * tao-sqlite - A mega-object system based on Sqlite data containers ---- '''Introduction to TAO Programming''' Tao is language extension to TclOO. All Tao code is inheritable by TclOO and any TclOO class can be inherited by Tao. The rules of TAO are designed to make behavior predictable for very large, complex, and otherwise nasty class hierarchies. TclOO code can be fed, without only slight modification, into the Tao. Tao adds the following features to TclOO Objects: * properties - Data the propagates the same was as code throughout your class hierarchies * option handling - Built in tk-style option handling. (Even for non tk-objects) * ensemble methods - A language convention that allows complex method to be broken up into ensembles and be implemented piecewise. * sqlite introspection - Data for Tao is tracked using an sqlite backend * class methods - Methods that apply to the class, and not the objects of the class. * message passing - Tao provides an sqlite based mechanism for inter-object communication * organ-i-zation - Tao adds the concept of "organs" or "pointers" to facilitate breaking complex jobs into multiple object. A typical class looks something like this: ====== ### # Someone who potentially own a towel ### tao::class owner { variable inventory {} ### # An ensemble that implements "inventory" ### method inventory::add {type object} { my variable inventory dict lappend inventory $type $object } method inventory::remove {type object} { my variable inventory set list [my inventory list $type] ldelete list $object dict set inventory $type $list } method inventory::list {type} { my variable inventory if {[dict exists $inventory $type]} { return [dict get $inventory $type] } return {} } ### # an extension to the "is" ensemble which defines # the state of hoopy as knowing where one's towel is # namely by having it on one's person ### method is::hoopy {} { my variable in foreach towel [my inventory list towel] { if { [$towel location] eq [my location] } } { return 1 } } return 0 } } tao::class towel { superclass linen option owner {default nobody} method initialize {} { if {[my cget owner] ne "nobody"} { my Newowner [my cget owner] } } ### # Show off grafting. When we get a new owner # we link ourselves to the new owner AND we # create a link that allows us to access the owner object # as a public method "owner" or private method "" ### method Newowner newowner { if {[my organ owner] ni {nobody {}}} { my inventory remove towel [self] } my graft owner $newowner my inventory add towel [self] } } ====== ---- <> Glossary | Object Orientation