proc p {{a A} args b {c C} d} {...}+
From 6233a6c5d39928f1bfafa8f41cb1ddf0c5a83de0 Mon Sep 17 00:00:00 2001
From: Steve Bennett Jim Tcl v0.71 -
+ Jim Tcl v0.72 -
overview of the Jim tool command language facilities
+procs now allow args and optional parameters in any position
+
+Add Tcl-compatible expr functions, rand() and srand()
+
+Add support for the -force option to file delete
+
+Better diagnostics when source fails to load a script with a missing quote or bracket
+
+New tcl_platform(pathSeparator)
+
- Unary functions.
+ Unary functions (except rand() which takes no arguments)
int() converts the numeric argument to an integer by truncating down.
double() converts the numeric argument to floating point.
round() converts the numeric argument to the closest integer value.
abs() takes the absolute value of the numeric argument.
+ rand() takes the absolute value of the numeric argument.
+ rand() returns a pseudo-random floating-point value in the range (0,1).
+ srand() takes an integer argument to (re)seed the random number generator. Returns the first random number from that seed.
The proc command is used to create a new Tcl command procedure: proc name args ?statics? body proc name arglist ?statics? body The new command is name name, and it replaces any existing command
there may have been by that name. Whenever the new command is
invoked, the contents of body will be executed by the Tcl
interpreter. args specifies the formal arguments to the procedure.
+ arglist specifies the formal arguments to the procedure.
It consists of a list, possibly empty, of the following
argument specifiers:
Variable Argument - The special name args, which is
- assigned all remaining arguments (including none). The
+ assigned all remaining arguments (including none) as a list. The
variable argument may only be specified once. Note that
the syntax args newname may be used to retain the special
behaviour of args with a different local name. In this case,
@@ -2162,30 +2195,6 @@ argument specifiers: Arguments must be provided in the following order, any of which
-may be omitted:
-Required Arguments (Left)
-
-Optional Arguments
-
-Variable Argument
-
-Required Arguments (Right)
- When the command is invoked, a local variable will be created for each of
the formal arguments to the procedure; its value will be the value
of corresponding argument in the invoking command or the argument’s
@@ -2194,31 +2203,98 @@ default value.NAME
RECENT CHANGES
Changes between 0.71 and 0.72
+
+
Changes between 0.70 and 0.71
@@ -2154,7 +2187,7 @@ argument specifiers:
-
Actual arguments are assigned to formal arguments as follows:
Actual arguments are assigned to formal arguments as in left-to-right +order with the following precedence.
-Left Required Arguments are assigned from the left +Required Arguments (including Reference Arguments)
-Right Required Arguments are assigned from the right -
--Default Arguments are assigned from the left, following the Left Required Arguments. +Optional Arguments
-A list is formed from any remaining arguments, which are then - are assigned to the args Variable Argument (if specified). The list will be empty - if there are no remaining arguments. +Variable Argument
The following example illustrates precedence. Assume a procedure declaration:
proc p {{a A} args b {c C} d} {...}+
This procedure requires at least two arguments, but can accept an unlimited number. +The following table shows how various numbers of arguments are assigned. +Values marked as - are assigned the default value.
Number of arguments | +a | +args | +b | +c | +d | +
---|---|---|---|---|---|
2 |
+- |
+- |
+1 |
+- |
+2 |
+
3 |
+1 |
+- |
+2 |
+- |
+3 |
+
4 |
+1 |
+- |
+2 |
+3 |
+4 |
+
5 |
+1 |
+2 |
+3 |
+4 |
+5 |
+
6 |
+1 |
+2,3 |
+4 |
+5 |
+6 |
+
When body is being executed, variable names normally refer to local variables, which are created automatically when referenced and deleted when the procedure returns. One local variable is automatically created @@ -3111,7 +3187,7 @@ if {[$e var]} { command. The legal options are:
@@ -3122,7 +3198,7 @@ command. The legal options are:
@@ -3133,7 +3209,7 @@ command. The legal options are:
@@ -3151,7 +3227,7 @@ command. The legal options are:
@@ -3162,7 +3238,7 @@ command. The legal options are:
@@ -3173,7 +3249,7 @@ command. The legal options are:
@@ -3185,7 +3261,7 @@ command. The legal options are:
@@ -3530,12 +3606,14 @@ abbreviation for option is acceptable. The valid options are:<
Deletes file or directory name. If the file or directory doesn’t exist, nothing happens. - If it can’t be deleted, an error is generated. Non-empty directories will not be deleted. + If it can’t be deleted, an error is generated. Non-empty directories will not be deleted + unless the -force options is given. In this case no errors will be generated, even + if the file/directory can’t be deleted.
Returns the name of the binary file from which the application - was invoked, either - as a path relative to the current directory or as a full - path. If the path can’t be determined, returns the empty - string. + was invoked. A full path will be returned, unless the path + can’t be determined, in which case the empty string will be returned.
@@ -6471,11 +6547,11 @@ to prevent infinite errors. (A time event handler is always removed after execut
- A TCP socket server (addr defaults to 0.0.0.0 for IPv4 or [::] for IPv6). + A TCP socket server (addr defaults to 0.0.0.0 for IPv4 or [::] for IPv6).
tcl_platform(byteOrder) = littleEndian -tcl_platform(os) = Darwin -tcl_platform(platform) = unix -tcl_platform(pointerSize) = 8 -tcl_platform(threaded) = 0 -tcl_platform(wordSize) = 8+
tcl_platform(byteOrder) = littleEndian +tcl_platform(os) = Darwin +tcl_platform(platform) = unix +tcl_platform(pointerSize) = 8 +tcl_platform(threaded) = 0 +tcl_platform(wordSize) = 8 +tcl_platform(pathSeparator) = :