Version 4 of Hunt for Tcl Extensional Equivalents

Updated 2007-07-09 16:08:49 by LV

CMcC 8/7/7 Tcl contains some semantic equivalences such as:

Example:

        set abc "123"
        set xyz $abc

or

        set xyz [set abc]

Example:

[replace with example]

Example:

[replace with example]

  • global ~~ ::

Example:

        set abc $::env(HOME)

or

        global env
        set abc $env(HOME)

Where ~~ can be read as approximates

  • {} ~~ [list]

Example:

        set var1 {1 2 3}
        set var1 [list 1 2 3]

Add more if you find them. The hunt is on.


escargo 7/7/7 - Are you looking for examples how these are not equivalent? CMcC I changed it to 'approximates.'

For example, I seem to recall that [eval] does a round of substitution before evaluating its input. (Logically, it would seem to be necessary for [] !~ [eval], otherwise eval is just taking up space.)

And subst takes arguments that allow limitations on the substitutions.

LV I think what is being sought are cases where there is more than one way to do it, as the Perl community says. This could be cases of Tcl syntactical sugar (notational shortcut approximates).


Category Language