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]
- [REBOL] Rebol evolution jbone
- [REBOL] How do I ... bobr
- [REBOL] How do I call other apps in a cgi? Re: bobr
- [REBOL] How do I call other apps in a cgi? Re:(2... ralph
- [REBOL] How do I call other apps in a cgi? Re:(3... bobr
- [REBOL] How do I save and restore an array of ob... bobr
- [REBOL] How do I save and restore an array of ob... icimjs
- [REBOL] How do I save and restore an array of ob... bobr
- [REBOL] How do I save and restore an array of ob... icimjs
- [REBOL] How do I save and restore an array of ob... Al . Bri
- [REBOL] How do I conditionally shadow a variable Re:... bobr
- [REBOL] How do I conditionally shadow a variable... icimjs
- [REBOL] How do I conditionally shadow a variable... bobr
- [REBOL] How do I conditionally shadow a variable... joel . neely
- [REBOL] How do I institute change to rebol Re: bobr
- [REBOL] OpenSource REBOL icimjs
- [REBOL] OpenSource REBOL Re: jbone
- [REBOL] OpenSource REBOL Re:(2) icimjs
- [REBOL] OpenSource REBOL Re:(3) nrc
- [REBOL] OpenSource REBOL Re:(3) jbone
- [REBOL] OpenSource REBOL Re:(4) icimjs
