AT&T Home | AT&T Labs | Research
AT&T Labs, Inc. - Research

The Yoix® Scripting Language

Home | What's New | Grammar | Documentation | Download | License | YChart | YDAT | YWAIT | Byzgraf | FAQs
save grammar
 
A save statement guarantees that the value and access permissions associated with a variable defined outside the current block will be restored when the block ends. Its usage description can be summarized as follows:
Statement:
	save Lvalue ;
	save Lvalue = Expression ;

When a block is about to end, the Yoix interpreter executes the code associated with the last finally statement that it encountered in the block and then it restores saved variables in the opposite order that they were saved. Even though finally can restore variables, save is more efficient and is the only way to reset access permissions.
 
 Example:   The program
import yoix.stdio.*;

int dummy = 12;

{
    save dummy;

    const dummy = 200;

    finally {
	printf("dummy=%d\n", dummy);
    }
}

printf("original dummy=%d\n", dummy);
dummy++;
printf("updated dummy=%d\n", dummy);
prints
dummy=200
original dummy=12
updated dummy=13
on standard output.
 
 See Also:   finally, reference

 

Yoix is a registered trademark of AT&T Inc.