TclOO Package

Check-in [8887ba1542]
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Backport of minor docfixes from tcl:465213d171, tcl:2c509f6291 and tcl:d06b029d9d.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 8887ba15422e89c2512f41d8d940b75fffb540b6
User & Date: dkf 2015-08-18 17:48:25
Original Comment: Backport of minor docfixes from [tcl:465213d171], [tcl:2c509f6291] and [tcl:d06b029d9d].
Context
2015-11-22
08:36
tcl:3d96b7076e Prevent crashes when destroying an object's class inside a method call. check-in: 426f9ef2c6 user: dkf tags: trunk
2015-08-18
17:48
Backport of minor docfixes from tcl:465213d171, tcl:2c509f6291 and tcl:d06b029d9d. check-in: 8887ba1542 user: dkf tags: trunk
2015-07-10
13:02
Implement TIP 436: Improve TclOO isa Introspection check-in: 5fa1374aa0 user: dkf tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to doc/Method.3.

63
64
65
66
67
68
69
70


71
72
73
74
75
76
77
The object to create the method in.
.AP Tcl_Class class in
The class to create the method in.
.AP Tcl_Obj *nameObj in
The name of the method to create. Should not be NULL unless creating
constructors or destructors.
.AP int isPublic in
A boolean flag saying whether the method is to be exported.


.AP Tcl_MethodType *methodTypePtr in
A description of the type of the method to create, or the type of method to
compare against.
.AP ClientData clientData in
A piece of data that is passed to the implementation of the method without
interpretation.
.AP ClientData *clientDataPtr out






|
>
>







63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
The object to create the method in.
.AP Tcl_Class class in
The class to create the method in.
.AP Tcl_Obj *nameObj in
The name of the method to create. Should not be NULL unless creating
constructors or destructors.
.AP int isPublic in
A flag saying what the visibility of the method is. The only supported public
values of this flag are 0 for a non-exported method, and 1 for an exported
method.
.AP Tcl_MethodType *methodTypePtr in
A description of the type of the method to create, or the type of method to
compare against.
.AP ClientData clientData in
A piece of data that is passed to the implementation of the method without
interpretation.
.AP ClientData *clientDataPtr out

Changes to doc/my.n.

31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
.SH EXAMPLES
This example shows basic use of \fBmy\fR to use the \fBvariables\fR method of
the \fBoo::object\fR class, which is not publically visible by default:
.CS
oo::class create c {
    method count {} {
        \fBmy\fR variable counter
        print [incr counter]
    }
}
c create o
o count              \fI\(-> prints "1"\fR
o count              \fI\(-> prints "2"\fR
o count              \fI\(-> prints "3"\fR
.CE






|







31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
.SH EXAMPLES
This example shows basic use of \fBmy\fR to use the \fBvariables\fR method of
the \fBoo::object\fR class, which is not publically visible by default:
.CS
oo::class create c {
    method count {} {
        \fBmy\fR variable counter
        puts [incr counter]
    }
}
c create o
o count              \fI\(-> prints "1"\fR
o count              \fI\(-> prints "2"\fR
o count              \fI\(-> prints "3"\fR
.CE

Changes to doc/next.n.

119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
...
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
        puts "before chaining from subclass, args = $args"
        \fBnext\fR a {*}$args b
        \fBnext\fR pureSynthesis
        puts "after chaining from subclass"
    }
}
theSubclass create obj
oo::define obj method example args {
    puts "per-object method, args = $args"
    \fBnext\fR x {*}$args y
    \fBnext\fR
}
obj example 1 2 3
.CE
prints the following:
................................................................................
        unset ValueCache
        \fI# Skip the cacheing\fR
        return -level 2 ""
    }
}

oo::object create demo
oo::define demo {
    mixin cache
    method compute {a b c} {
        after 3000 \fI;# Simulate deep thought\fR
        return [expr {$a + $b * $c}]
    }
    method compute2 {a b c} {
        after 3000 \fI;# Simulate deep thought\fR






|







 







|







119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
...
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
        puts "before chaining from subclass, args = $args"
        \fBnext\fR a {*}$args b
        \fBnext\fR pureSynthesis
        puts "after chaining from subclass"
    }
}
theSubclass create obj
oo::objdefine obj method example args {
    puts "per-object method, args = $args"
    \fBnext\fR x {*}$args y
    \fBnext\fR
}
obj example 1 2 3
.CE
prints the following:
................................................................................
        unset ValueCache
        \fI# Skip the cacheing\fR
        return -level 2 ""
    }
}

oo::object create demo
oo::objdefine demo {
    mixin cache
    method compute {a b c} {
        after 3000 \fI;# Simulate deep thought\fR
        return [expr {$a + $b * $c}]
    }
    method compute2 {a b c} {
        after 3000 \fI;# Simulate deep thought\fR