[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:Mon Nov 4 23:49:31 1999 
Subject:Re: Robin on lexical locals 
From:Aaron Sloman See text for reply address 
Volume-ID:991104.02 

pop@roo.cs.umass.edu (Robin Popplestone) writes:

> Aaron said
>
> > I suppose one problem is that a user may accidentally include a
> > protected identifier because of leaving out a semi-colon, or
>
>     define foo(p, q) -> z;
>         lvars x = ..., y = ...,
>         x + y -> z
>     enddefine;
>
> Which is why I always use my let construct which requires "in" to
> terminate the list of variables being declared. Besides, it gives
> POP a less antique look.
>
>
>     define foo(p, q) -> z;
>         let x = ..., y = ...,
>         in
>             x + y -> z
>         endlet
>     enddefine;

I guess you can define your "let" macro (or syntax word) call
sysunprotect and then sysprotect. In between it would have to invoke
pop11_comp_expr to read and compile the expression using the
unprotected identifiers.

For some reason I've lever liked the "let" construct. I generally
prefer a sequence of less deeply nested expressions to a single more
deeply nested one (like sentences).

However, I can see that using "let" gives a more structured style,
and saves having to use lblock and endlblock.

> And, while I do still manage to remember "sysunprotect", 'taint clear that
> your average user would. R.

I think your average user (including most student users) probably
would need the protection against errors more than the ability to
redefine protected system identifiers locally.

I've just remembered that HELP COMPILE_MODE mentions a compile time
switch that does what you want:

    prmprt      If unset, an error is NOT signalled if a protected
                permanent identifier is redeclared (by sysSYNTAX,
                ident_declare etc).

So to turn off the checking in a procedure or a file you should be
able to use
    compile_mode :vm -prmprt;

Thank John Gibson!

aaron
===
-- 
Aaron Sloman, ( http://www.cs.bham.ac.uk/~axs/ )
School of Computer Science, The University of Birmingham, B15 2TT, UK
EMAIL A.Sloman AT cs.bham.ac.uk   (NB: Anti Spam address)
PAPERS: http://www.cs.bham.ac.uk/research/cogaff/