hi all:
matju and i have been working on some documentation of DesireData, below is the part that describes the objective TCL currently implemented in the client side. hope it will be interesting/useful to some:)
current classes:
thing `-> view <- observable |-> wire |-> canvas |-> scalar `-> box |-> textbox | |-> objectbox | |-> atombox | `-> messagebox |-> numbox |-> comment |-> radio |-> slider |-> bang |-> toggle |-> vu |-> dropper `-> cnv
Class declaration: The way each class is created is done by calling proc class_new {self {super {thing}}}. For example, to initialize the textbox class, we will do "class_new textbox {view}". This will first declare itself being a valid class and also its superclass, and then further define methods to create each instances of the class. As a result, each instance of the class can be created by calling CLASSNAME_new or CLASSNAME_new_as.
class modification: the combination of "proc def {class selector args body}" and the modification to proc unknown provides the mechanism to call methods on each instance of class view's sub-calsses. First, proc def defines a proc ${class}_$selector to be declared. For example, calling def objectbox draw will define a proc objectbox_draw. Second, by adopting a proc lookup_method, it is then possible at the end to call a method of each instance of an class through the following syntax: OBJECT_ID ACTION ARG1 ARG2 ..... for example, the following syntax "825ea50 init 450 500 +0+0 1" will initialize object 825ea50 with the arguments of 450 500 +0+0 1 and it's canvas in this case. In such syntax, OBJECT_ID is called the receiver of the message and the ACTION is the selector. This implementation of calling methods can be described as the "subject verb complement" syntax. In Objective Tcl, this is the syntax that enables the lookup, while its original form looks like this: canvas_init $OBJECT_ID $ARG1 $ARG2 ...
the @ sigil: In objective TCL, '@' is used to prefixs '_($self:)' part of the name of the variable. This makes typing variable names much quicker. For example, instead of typing _($self:x), all we need to do now is just @x. Furthermore, this makes it easy to adapt the existing code to work with the new "dict" feature in TCL 8.5. All that is required is to update the arguments of regsub that handles the prefix substitution.
many thanks
chun
On Mon, 10 Oct 2005, chun wrote:
matju and i have been working on some documentation of DesireData, below is the part that describes the objective TCL currently implemented in the client side. hope it will be interesting/useful to some:)
Just a quick note to say that Objective Tcl is an extension to the Tcl language that I'm writing in Tcl. The source code is about two pages long for now.
All impd/dd is being rewritten around it so that the code becomes even more short and even more flexible. At PdConvention I mentioned that I could come to do it one day. Well, it's done now.
____________________________________________________________________ Mathieu Bouchard - tél:+1.514.383.3801 - http://artengine.ca/matju Freelance Digital Arts Engineer, Montréal QC Canada