local uses of "vars" 
Author Message
 local uses of "vars"

I am coming to the conclusion that Aaron is right - the warning messages
produced by  vars  when it is used inside a procedure are more trouble
than they're worth. (Given the prevalence of  vars  inside procedures in
existing documentation).

Aaron suggests redefining  vars  to not print these warnings, as follows:

Quote:
>lvars oldvars = nonsyntax vars;

>sysunprotect("vars");

>define syntax vars;
>   ;;; It should work as normal outside procedure definitions, and
>   ;;; suppress warning messages inside procedure definitions.
>   lvars item;
>   if popexecute then
>       oldvars();
>   else
>       repeat
>           readitem() -> item;
>       quitif(item = ";");
>           unless item = "," then
>               sysSYNTAX(item, 0, false);
>               sysLOCAL(item)
>           endunless;
>       endrepeat;
>       ";" :: proglist -> proglist;
>   endif;
>enddefine;

>sysprotect("vars");

Please would people instead use this re-definition:

    sysunprotect("vars");

    define syntax vars;
        pop11_comp_declaration(sysVARS, "undef")
    enddefine;

    sysprotect("vars");

as it is more correct (and shorter).

If you put this code in a file called "init.p" in your home directory
it will be loaded automatically every time you startup Poplog.

John Williams (Poplog development team).



Fri, 15 May 1998 03:00:00 GMT  
 local uses of "vars"
For some reason this did not join the pop-forum list nor get onto
comp.lang.pop when I first sent it.

John,
Many thanks for your much nicer definition.

Quote:

> Date: 27 Nov 1995 19:17:14 -0000

> Please would people instead use this re-definition:

>     sysunprotect("vars");

>     define syntax vars;
>         pop11_comp_declaration(sysVARS, "undef")
>     enddefine;

>     sysprotect("vars");

> as it is more correct (and shorter).

> If you put this code in a file called "init.p" in your home directory
> it will be loaded automatically every time you startup Poplog.

Unfortunately this clobbers other things, like

        define vars foo(x,y);
                ....
        enddefine;

This produces a misplaced syntax word error. My version did also!

So I am now using the following.

     define syntax pvars;
                ;;; for locally declaring pattern variables, etc.
         pop11_comp_declaration(sysVARS, "undef")
     enddefine;

Then I use "pvars" for the old style local "vars" definitions.

Moral: ANY system-produced warning message should use a user-definable
print procedure, like prwarning. Then we could simply turn off the
warnings, or produce them more selectively.

Aaron
--
Aaron Sloman, ( http://www.cs.bham.ac.uk/~axs )
School of Computer Science, The University of Birmingham, B15 2TT, England

Phone: +44-121-414-4775 (Sec 3711)       Fax:   +44-121-414-4281



Sat, 16 May 1998 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. "Static" rexx vars

2. string.join(["Tk 4.2p2", "Python 1.4", "Win32", "free"], "for")

3. Witness Lee and the "Local Churches": A Personal Testimony

4. Clipper Debugger "loses" Local variables

5. "Local" Batch Files

6. "local l : like Result"

7. Local directory search "server" script

8. Dr. Scheme "local"?

9. Question about "exec in globals, locals"

10. Run a local script while "expecting"

11. Extraneous "eval" in ::itcl::local

12. New Tcl magazine "Tickle Talk", buy it at your local newsstand today

 

 
Powered by phpBB® Forum Software