Re: String Literals, take 3

[email protected] (Andrew Wilson) Thu, 5 Dec 2002 17:09:35 +0000
Newsgroups perl.perl6.documentation
Message-ID <[email protected]>
--DqhR8hV3EnoxUkKN
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Thu, Dec 05, 2002 at 07:54:09PM +0200, arcadi shehter wrote:
> my take :=20
>=20
> non interpolating construct is a sequence of characters enclosed in
> delimiters for which perl switch off *any* perl-programm-like
> interpretation of the content.  since perl have to find the end of
> this "I-am-not-looking" phase , the delimiter itself have to appear insid=
e the
> string prefixed by backslash "\" and since now "\" itself acquire
> special "assignment" , if it is meant to be part of the string it have to
> appear backslash-prefixed "\\" itself. In principle *any* character can be
> backslashed *inside* the string , but only for delimiter and the
> backslash this is absolutely necessary.=20
>=20
> in this sence interpolated string is "language inside language" .=20
> hence :=20
>  * some characters ( or words ) have to be "reserved in the inner
>    language in order for outer language to know where the inner
>    language text stops.
>  * this is achieved by chosing a prefix , and any character from outer
>    language is represented in the inner languge by the same character
>    with prefix - two character sequance=20
>  * for all *except* two characters -- the delimiter and the prefix --
>    we can make syntactic sugar of making the character to "mean"
>    itself .
>=20
>=20
>=20
>=20
>     '\ \ \h\e\l\l\o\ \ '
>=20
> '\'\\\ \\\ \\\h\\\e\\\l\\\l\\\o\\\ \\\ \''

This is wrong.  '\ \ \h\e\l\l\o\ \ ' gives you a string with nine
backslashes.

andrew
--=20
Capricorn: (Dec. 22 - Jan. 19)
After all is said and done, no one will have said or done anything
involving you in any way.

--DqhR8hV3EnoxUkKN
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE974hP4x3z39L355MRAiRlAJ9gLryZ82C1YtQYZmavtxfvS/nCtwCgr02M
nNsHCX2Rz8KOBwijvEdSKYo=
=OCnf
-----END PGP SIGNATURE-----

--DqhR8hV3EnoxUkKN--