In some more modern languages (not C)
it is possible to conditionally mask the old value of a variable
that is picked up in subordinate functions.

a perl example:

#!/usr/bin/perl

  $n1 = 1;
sub readFile { local( $name) = @_;
    if ($a1) { 
         local( $n1) = 300; 
         doincl();
             } 
    doincl();
}
sub doincl {
    print ("includelevel: $n1 $name\n");
    $n1 += 1;
}
$a1 = 0; readFile("zzz");
$a1 = 1; readFile("this");
$a1 = 0; readFile("that");

_____________output___________________
includelevel: 1 zzz
includelevel: 300 this
includelevel: 2 this
includelevel: 3 that


what is the most succinct way to achive this
shadowing in Rebol?   remember, n1 has to go back
to the old value before doincl is called the second time
in readFile.  creating a function to hold the inner
block of the if is not considered very succinct
by my critics.


{-----}
[EMAIL PROTECTED]

Reply via email to