[% setvar title Pascal-like "with" %]

This file is part of the Perl 6 Archive

Note: these documents may be out of date. Do not use as reference!

To see what is currently happening visit http://www.perl6.org/

TITLE

Pascal-like "with"

VERSION

  Maintainer: David Nicol <perl6rfc@davidnicol.com>
  Date: 28 Sep 2000
  Mailing List: perl6-language@perl.org
  Number: 342
  Version: 1
  Status: Developing

ABSTRACT

We adopt Pascal's very useful with syntax

DESCRIPTION

        %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.

IMPLEMENTATION

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.

REFERENCES

"Learning Pascal" textbook, CS101, 1985