develooper Front page | perl.perl6.documentation | Postings from December 2002

Re: String Literals, take 3

Thread Previous | Thread Next
From:
John Williams
Date:
December 5, 2002 13:29
Subject:
Re: String Literals, take 3
Message ID:
Pine.LNX.4.33.0212051411420.23507-100000@sharkey.morinda.com
> There are a few special cases for delimeters; specifically :, ( and #.
> : is not allowed because it might be used by custom-defined quoting
> operators to apply a attribute.  ( is not allowed because it is used to
> pass arguments to attributes.

But if there is no attribute, then qw(this is not ambiguous), so why
disallow it?

> =head3 Embedding Interpolated Strings
>
> It is also possible to embed an interpolating string within a non-
> interpolating string by the use of the \qq[] construct.  A string
> inside a \qq[] constructs acts exactly as if it were an interpolated
> string.  Note that any end-brackets, "]", must be escaped within the
> the \qq[] construct so that the parser can read it correctly.

They only need to be escaped if they are not balanced.

perl5 -le 'print q{ q{ q{} } }'

does just what you expect it to do, and I don't think perl6 will be less
dwimmish.

> =item Default Object Stringification C<"$obj">
> # Behavior not defined

It should be defined as "whatever $obj.as_string returns".

> Also note that with single quoted here-docs, backslashes are not
> special, and are taken for a literal backslash, a behaivor that is
> different from normal single-quoted strings.  However, \qq[] will
> still work.

That's self-contractidictory: "backslashes are not special" and
"\qq[] is special"

Isn't there any way to say "none of the following characters are special
until I say so" left in perl6?

~ John Williams




Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About