Index: xotcl/tests/forwardtest.xotcl =================================================================== diff -u -rad8a63234e44a8788efede276e811051ab891fbe -rbb3c756fb47517596b9dbcb4e580aa1212827b41 --- xotcl/tests/forwardtest.xotcl (.../forwardtest.xotcl) (revision ad8a63234e44a8788efede276e811051ab891fbe) +++ xotcl/tests/forwardtest.xotcl (.../forwardtest.xotcl) (revision bb3c756fb47517596b9dbcb4e580aa1212827b41) @@ -1,4 +1,4 @@ -# $Id: forwardtest.xotcl,v 1.5 2005/09/09 21:09:01 neumann Exp $ +# $Id: forwardtest.xotcl,v 1.6 2006/09/14 06:36:02 neumann Exp $ package require XOTcl namespace import -force xotcl::* package require xotcl::test @@ -195,7 +195,26 @@ ? {obj @list} [list x 1 y 2 z] ? {obj @list a b c} [list x 1 y 2 z a b c] +############################################### +# substitution depending on number of arguments +############################################### +obj forward f %self [list %argclindex [list a b c]] +obj proc a args {return [list [self proc] $args]} +obj proc b args {return [list [self proc] $args]} +obj proc c args {return [list [self proc] $args]} +? {obj f} [list a {}] +? {obj f 1 } [list b 1] +? {obj f 1 2} [list c {1 2}] +? {catch {obj f 1 2 3}} 1 + +############################################### +# option earlybinding +############################################### +obj forward s -earlybinding ::set %proc +? {obj s 100} 100 +? {obj s} 100 + Object instproc f args { next } Class NS