Re: String Literals, take 1
[email protected] (Jonathan Scott Duff) Sat, 30 Nov 2002 22:41:07 -0600
| Newsgroups | perl.perl6.documentation |
|---|---|
| Message-ID | <[email protected]> |
On Sat, Nov 30, 2002 at 12:40:28AM +0000, Joseph Ryan wrote:
> Anyways, here's a first draft of the string documentation ...
I didn't see any mention of vstrings (e.g. tokens of the form
v5.8.0. I also got the impression from a response Larry made to one
of the emails in the thread on numbers that the leading v might be
optional)
Also, I didn't see mention of the string context coercer which though
it doesn't really have to do with literals, probably should have a
reference here somewhere.
> - Larry was never specific as to how hashes interpolate; anyone have
> any ideas?
I'd think that hashes would interpolate as a list of
key,value,key,value,etc.
BTW, how do pairs interpolate?
> =pod
>
> =head1 Strings
>
> A string is a literal value that represents a sequence of characters.
> A string object is formed when a sequence of characters is enclosed in
> one of the quoting operators, of which there are 3 types:
> Interpolating, Non-Interpolating, and Here-Docs;
This classification doesn't make sense to me. Here-docs are just another
quoting operator which can be interpolating or non-interpolating..
Also, the whole idea of "interpolation" probably needs to be
explained up front. Maybe something like this:
There are two types of quoting operators: interpolating and
non-interpolating. In interpolating constructs, the value of a
variable is substituted for the variable name within the string
and certain characters have special meaning when preceded by a
backslash (C<\>). In non-interpolating constructs, a variable
name that appears within the string is used as-is. The simplest
examples of these two types of quoting operators are strings
delimited by double (interpolating) and single quotes
(non-interpolating). For example:
'The quick brown $animal'
"The quick brown $animal"
In the first string, perl will take each character literally and
perform no special processing. In the second string, the value
of the variable $animal is inserted within the string at that
location. If $animal had had the value "fox", then the second
string would have become "The quick brown fox".
More on the various quoting operators below.
> =head2 Non-Interpolating Constructs
oh, a minor nit here ... tackle the items in the order that you first
list them. In your 3 type classification you mention interpolating
first then non-interpolating, so you should start off talking about
interpolating or switch the order in the list.
-Scott
--
Jonathan Scott Duff
[email protected]