[% setvar title Selective interpolation in single quotish context. %]
To see what is currently happening visit http://www.perl6.org/
Selective interpolation in single quotish context.
Maintainer: Brad Hughes <email@example.com> Date: 14 Sep 2000 Last Modified: 14 Sep 2000 Mailing List: firstname.lastname@example.org Number: 226 Version: 2 Status: Developing
Perl6 should allow scalars and arrays to be tagged such that they are interpolated in single quotish context.
Single quotish context, such as
'', and specified here-docs,
is especially useful for large blocks of text which may contain
@ characters. Frequently, however, interpolation within
that large block of text is desired. This RFC proposes that in single
quotish context scalars and arrays may be tagged to be interpolated.
As an example, on the VMS operating system the
$ runs rampant
through VMS namespaces, not to mention that each line of VMS' equivalent
of a Unix shell script (called a .com file) starts with a
$, and execution
of VMS .com files is invoked with a
@, resulting in backslashitis:
print F <<END; \$! \$! execute a.com, copy and purge \$! \$ \@sys\$login:a.com \$ copy $filename sys\$login:*.* \$ purge sys\$login:$filename \$! \$ exit END
With this proposal, the scalar
$filename can be tagged to be interpolated
\I...\E pair and the double quotish context replaced by single
quotish context resulting in the following:
print F <<'END'; $! $! execute a.com, copy and purge $! $ @sys$login:a.com $ copy \I$filename\E sys$login:*.* $ purge sys$login:\I$filename\E $! $ exit END
An array can be similarly tagged. Would
\I&subr\E call subr?.
This wouldn't seem a difficult change to make.
Originally suggested in a different form by Jarkko Hietaniemi <email@example.com> in <archive address to follow>, and seconded by Mark-Jason Dominus <firstname.lastname@example.org> in <archive address to follow>. Version 2 tag pair suggested by Damian Conway in <...>.