A tiny bit of code by RS puzzles me

From: Helmut Giese (hgiese_at_ratiosoft.com)
Date: 11/27/04

  • Next message: Kevin Walzer: "Re: popen3 for tcl?"
    Date: Sat, 27 Nov 2004 02:15:10 GMT
    
    

    Hello out there,
    passing some time, reading Dr. Dobb's Tcl-URL from Nov. 23 and
    following some links I hit on http://mini.net/tcl/4613. There you find
    some code snippet to implement type checking:
            ---
    proc integer args {
        foreach arg $args {
            uplevel 1 "trace var $arg w {incr $arg 0 ;#}"
        }
    }
    integer i
    set i x
    # - > can't set "i": expected integer but got "x"
            ---
    The principle is clear, but I started wondering about the curious
    ';#}' construct. The first thing to do is of course to remove ';#' but
    it's there for a purpose: Omitting it produces the error message
       can't set "i": wrong # args: should be "incr varName ?increment?"

    I stared for a while, but it's late now and I give up. Could someone
    please explain what this ';#}' construct does? What does [incr] see,
    if it's not there?
    Any insight will be greatly appreciated.
    Best regards and good night
    Helmut Giese


  • Next message: Kevin Walzer: "Re: popen3 for tcl?"

    Relevant Pages

    • Re: [PATCH] slub: reduce total stack usage of slab_err & object_err
      ... vprintf(fmt, args); ... When calling a varargs function, the caller passes the number of ... Obviously, we're never passing floating point args in the kernel, so ... we're taking about a 40+ byte hit in code size and 128 byte hit in stack ...
      (Linux-Kernel)
    • RE: About send a string to a C# app
      ... Checkout this code snippet: ... static void Main(stringargs) ...
      (microsoft.public.dotnet.languages.csharp)
    • Re: subclassing "file"
      ... Oops, hit the wrong button. ... def write: ... Of course I used *args only because I'm to laze to name the actual arguments ...
      (comp.lang.python)