[% setvar title Pascal-like "with" %]
To see what is currently happening visit http://www.perl6.org/
Pascal-like "with"
Maintainer: David Nicol <perl6rfc@davidnicol.com> Date: 28 Sep 2000 Mailing List: perl6-language@perl.org Number: 342 Version: 1 Status: Developing
We adopt Pascal's very useful with syntax
%record = loadrecord($studentID);
with %record {
open SPAM, $PreferredSpam;
print <<SPAM;
Dear $Name:
Your tuition is now due. Please send in a payment
of at least $Minumum.
SPAM
};
All existing keys of %record hide similarly named variables,
if any, within the with block.
These things can nest.
within a with block, unqualified variable names
must be checked against the with name space before
being instantiated.
In concert with named packed structure types serious optimizations could be achieved.
"Learning Pascal" textbook, CS101, 1985