diff options
-rw-r--r-- | stdlib.tcl | 7 | ||||
-rw-r--r-- | tcltest.tcl | 2 | ||||
-rw-r--r-- | tests/alias.test | 4 |
3 files changed, 10 insertions, 3 deletions
@@ -1,5 +1,12 @@ # Implements script-based standard commands for Jim Tcl +if {![exists -command ref]} { + # No support for references, so create a poor-man's reference just good enough for lambda + proc ref {args} {{count 0}} { + format %08x [incr count] + } +} + # Creates an anonymous procedure proc lambda {arglist args} { tailcall proc [ref {} function lambda.finalizer] $arglist {*}$args diff --git a/tcltest.tcl b/tcltest.tcl index b98164a..b7e3983 100644 --- a/tcltest.tcl +++ b/tcltest.tcl @@ -166,7 +166,7 @@ proc testConstraint {constraint {bool {}}} { } testConstraint {utf8} [expr {[string length "\xc2\xb5"] == 1}] -testConstraint {references} [expr {[info commands ref] ne ""}] +testConstraint {references} [expr {[info commands getref] ne ""}] testConstraint {jim} 1 testConstraint {tcl} 0 diff --git a/tests/alias.test b/tests/alias.test index c539920..4f6e553 100644 --- a/tests/alias.test +++ b/tests/alias.test @@ -62,8 +62,8 @@ test curry-1.4 "Two word curry" { list [$two x] [$two y] } {1 0} -collect -test curry-1.5 "Delete curry" { +test curry-1.5 "Delete curry" references { + collect unset one two collect } {2} |