On Fri, Dec 06, 2002 at 10:16:20AM -0700, John Williams wrote:
: On Fri, 6 Dec 2002, Joseph F. Ryan wrote:
: >
: > What's wrong with single quoted here-docs?
: 
: What's wrong is that the documentation team is trying to allow \qq[]
: there too, contradicting their own assertion that backslashes are not
: special in that context.

Ahem.  If you go back and look again, you'll see that I'm the one
who contradicted the assertion...

: > Don't forget that the backslash is already special in
: > non-interpolating strings; I don't think that adding a single
: > special case will make things too confusing.
: >
: > >What if \q[] was allowed in interpolated strings, but not in
: > >non-interpolated strings.  Then I'm happy with that non-interpolated
: > >strings really don't interpolate, and you might be happy because it would
: > >only make sense to do one level of nesting. ie, you cannot embed \qq[]
: > >inside \q[].  Or you could do $(''), which is the same number of
: > >characters as \qq[], and doesn't require introducing
: > >yet-another-new-rule-to-an-already-too-complicated-escaping-system.
: >
: > I think \qq[] is the much more useful of the two, so
: > that really doesn't help much.
: 
: Oh well, I'm being overly-speculative above, which I shouldn't do on this
: list, but I was wondering if compromise was possible.  Changing the
: behavior of backslashes and balanced delimiters is also speculative.
: 
: The current behavior in perl5 is that only two sequences are special in
: non-interpolated strings
: 
:    \\ --> \
:    \<delim> --> <delim>
: 
: <delim> can be either the opening or closing delimiter when they are
: balanced.  So you CAN backslash them, but I don't HAVE to.
: 
: Larry has added \qq[] and \q[], so "\q" is now special.  (Are \qw[] and
: \qx[] in?  qw doesn't make sense, and qx might be insecure.)

That's not what I said.  I said that \qq[ is special.  Don't go
chopping my bracket off--I intend it to be required.  Also, there's
no reason to allow \q[] inside single quotes.  The others are rare
enough that they could be put inside \qq[].

In fact, if you want it all consistent, we could say that the *only*
way to put anything non-verbatim into any single-quoted string is
with \qq[].  So instead of '\\' you'd say '\qq[\\]' and instead of '\''
you'd say '\qq[']'.  (And no, the latter doesn't actually require a
backslash before the '.  If you think it does, you're still thinking
of a two-pass lexer like Perl 5.  Perl 6 will have a one-pass lexer,
and the only delimiter it's looking for at the time it sees the quote
is actually a right bracket.)

On the other hand, people are likely to expect \\ and \' to continue working
as they currently do in ordinary single quoted strings.  We could go with
the stricter rule for just single-quoted here docs, I suppose.

: I would really appreciate a ruling from the design team before we change
: non-interpolative semantics regarding:
: 
: 1) the interpretation of \<anything-else>,
:    PRO: it makes backslash behavior consistent
:    CON: the perl5 behavior is as unobtrusive as possible

Well, no, I don't think \\ and \' are really "as unobtrusive as possible"...

: 2) requiring balanced delimiters to be escaped,
:    PRO: it's consistent with non-balanced delimiter requirements
:    CON: you already can; don't force it those who don't want it

See above about one-pass lexer.  Balanced delimiters generally need no
backslashing unless they're a literal outside of any other bracketing
construct.

: 3) allowing \qq[] in single-quoted here-docs.
:    PRO: it's consistent with single-quotes
:    CON: it contradicts the assertion that backslashes are not special in
: single quoted here-docs
:         we need a quoting mechanism where NOTHING is special
: 
: (Those are ordered from least to most offensive, BTW.)

Then paint me most offensive, by all means.  :-)

Larry

Reply via email to