• =?UTF-8?Q?funny_tcl_bug=e2=80=a6?=

    From aotto1968@21:1/5 to All on Mon Aug 29 08:37:46 2022
    Hi, put code down in a "extra2.test" file and call it with :

    tclsh extra2.test 1 or 2 or 3

    ===============================
    lassign $argv num

    if { $num == 1 } {

    puts 1

    # } elseif { $num == 2 } {
    #
    # puts 2

    } else {

    puts 99

    }
    =================================

    tclsh extra2.test 1
    1

    tclsh extra2.test 2
    !! nothing !!

    tclsh extra2.test 3
    99


    → ha… ha… ha…

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Siri Cruise@21:1/5 to [email protected] on Mon Aug 29 02:40:04 2022
    In article <tehmrq$vjot$[email protected]>,
    aotto1968 <[email protected]> wrote:

    Hi, put code down in a "extra2.test" file and call it with :

    tclsh extra2.test 1 or 2 or 3

    ===============================
    lassign $argv num

    I've never been clear when the first argument is in argv or taken
    as stdin so I start with something like

    if {[lindex $argv 0]=="-"]} {set argv [lrange $argv 1 end]}

    --
    :-<> Siri Seal of Disavowal #000-001. Disavowed. Denied. Deleted. @
    'I desire mercy, not sacrifice.' /|¥ Discordia: not just a religion but also a parody. This post / ¥
    I am an Andrea Chen sockpuppet. insults Islam. Mohammed

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From EL@21:1/5 to [email protected] on Thu Sep 1 04:26:16 2022
    aotto1968 <[email protected]> wrote:
    Hi,

    This are MY rules for the new TCL

    1) add a simple pre-processor to TCL like CPP for C and add all the
    missing features like "(real)-comment" to top of this this
    pre-processor
    2) after preprocessing the OLD-Tcl parser get always "valid" TCL code
    2) to activate a NEW featur use the new "pragma ?feature?" command
    3) every TCL-Source-File is read with *source* and source is able to
    analyze the *pragma* and chose the proper pre-processor
    4) A *pragma* is only valid WITHIN the singe source-file currently read
    (ease mix OLD and NEW style code)

    This is actually quite possible. One of the absolute streghts of Tcl is,
    that the language is programmable itself. You can redefine every command,
    and as control constructs are commands themselves, you can redefine them as well.

    Have a look at „sugar“, a Lisp-like macro preprocessor for Tcl:

    https://wiki.tcl-lang.org/page/Sugar

    It is likely to help. And, as already mentioned, yes, have fun :-)

    BTW, I wish that a real and enhanced macro preprocessor like sugar was
    built into the Tcl core. It‘s something that I think would add a real
    benefit to the language…


    --
    EL

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)