Tcl Library Source Code

Check-in [14faa92003]
Login

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

Overview
Comment:oo::util - Fixed ticket [b3577ed586]. Added missing uplevel 1 which causes evaluation of a delegate in the wrong context. Started a testsuite. Packae version bumped to 1.2.1.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 14faa92003dd99e8b365428527ad2753376cacfa
User & Date: andreask 2014-09-22 23:24:15
Context
2014-09-22
23:33
Created the constraints in the previous commit, and still forgot to apply it. Now applied. check-in: 17f2ede061 user: andreask tags: trunk
23:24
oo::util - Fixed ticket [b3577ed586]. Added missing uplevel 1 which causes evaluation of a delegate in the wrong context. Started a testsuite. Packae version bumped to 1.2.1. check-in: 14faa92003 user: andreask tags: trunk
2014-09-21
13:26
Solve two tickets (one regarding Nelder-Mead and one regarding bigfloat2). Added test cases check-in: 6922235385 user: markus tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to modules/ooutil/ooutil.man.

1

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
[comment {-*- tcl -*- doctools manpage}]

[manpage_begin oo::util n 1.1]
[see_also snit(n)]
[keywords callback]
[keywords {class methods}]
[keywords {class variables}]
[keywords {command prefix}]
[keywords currying]
[keywords {method reference}]
[keywords {my method}]
[keywords singleton]
[keywords TclOO]
[copyright {2011-2013 Andreas Kupries, BSD licensed}]
[moddesc {Utility commands for TclOO}]
[titledesc {Utility commands for TclOO}]
[category  Utility]
[require Tcl 8.5]
[require TclOO]
[require oo::util [opt 1.1]]
[description]
[para]

This package provides a convenience command for the easy specification
of instance methods as callback commands, like timers, file events, Tk
bindings, etc.


>
|










|





|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
[comment {-*- tcl -*- doctools manpage}]
[vset OOUTIL_VERSION 1.2.1]
[manpage_begin oo::util n [vset OOUTIL_VERSION]]
[see_also snit(n)]
[keywords callback]
[keywords {class methods}]
[keywords {class variables}]
[keywords {command prefix}]
[keywords currying]
[keywords {method reference}]
[keywords {my method}]
[keywords singleton]
[keywords TclOO]
[copyright {2011-2014 Andreas Kupries, BSD licensed}]
[moddesc {Utility commands for TclOO}]
[titledesc {Utility commands for TclOO}]
[category  Utility]
[require Tcl 8.5]
[require TclOO]
[require oo::util [opt [vset OOUTIL_VERSION]]]
[description]
[para]

This package provides a convenience command for the easy specification
of instance methods as callback commands, like timers, file events, Tk
bindings, etc.

Changes to modules/ooutil/ooutil.tcl.

93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
oo::class create oo::class.Delegate {
    method create {name {script ""}} {
        if {[string match *.Delegate $name]} {
            return [next $name $script]
        }
        set cls [next $name]
        set delegate [oo::class create $cls.Delegate]
        oo::define $cls $script
        set superdelegates [list $delegate]
        foreach c [info class superclass $cls] {
            set d $c.Delegate
            if {[info object isa object $d] && [info object isa class $d]} {
                lappend superdelegates $d
            }
        }







|







93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
oo::class create oo::class.Delegate {
    method create {name {script ""}} {
        if {[string match *.Delegate $name]} {
            return [next $name $script]
        }
        set cls [next $name]
        set delegate [oo::class create $cls.Delegate]
        uplevel 1 [::list oo::define $cls $script]
        set superdelegates [list $delegate]
        foreach c [info class superclass $cls] {
            set d $c.Delegate
            if {[info object isa object $d] && [info object isa class $d]} {
                lappend superdelegates $d
            }
        }
178
179
180
181
182
183
184
185
    }
    return
}

# # ## ### ##### ######## ############# ####################
## Ready

package provide oo::util 1.2







|
178
179
180
181
182
183
184
185
    }
    return
}

# # ## ### ##### ######## ############# ####################
## Ready

package provide oo::util 1.2.1

Added modules/ooutil/ooutil.test.























































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# ooutil.test - Copyright (c) 2014 Andreas Kupries

# -------------------------------------------------------------------------

source [file join \
	[file dirname [file dirname [file join [pwd] [info script]]]] \
	devtools testutilities.tcl]

testsNeedTcl     8.5
testsNeedTcltest 2

# Check if we have TclOO available.
tcltest::testConstraint tcloo [expr {![catch {package require TclOO}]}]

support {
}
testing {
    useLocal ooutil.tcl oo::util
}

# -------------------------------------------------------------------------

test ooutil-ticket-b3577ed586 {test scoping of delegation in oo::class.Delegate } -setup {
    oo::class create animal {}
    namespace eval ::ooutiltest {
	oo::class create pet { superclass animal }
    }
} -body {
    namespace eval ::ooutiltest {
	oo::class create dog { superclass pet }
    }
} -cleanup {
    namespace delete ooutiltest
    rename animal {}
} -result {::ooutiltest::dog}

# -------------------------------------------------------------------------
testsuiteCleanup

# Local variables:
# mode: tcl
# indent-tabs-mode: nil
# End:

Changes to modules/ooutil/pkgIndex.tcl.

1
2
3
4
5
6
7
#checker -scope global exclude warnUndefinedVar
# var in question is 'dir'.
if {![package vsatisfies [package provide Tcl] 8.5]} {
    # PRAGMA: returnok
    return
}
package ifneeded oo::util 1.2 [list source [file join $dir ooutil.tcl]]






|
1
2
3
4
5
6
7
#checker -scope global exclude warnUndefinedVar
# var in question is 'dir'.
if {![package vsatisfies [package provide Tcl] 8.5]} {
    # PRAGMA: returnok
    return
}
package ifneeded oo::util 1.2.1 [list source [file join $dir ooutil.tcl]]