develooper Front page | perl.perl6.language | Postings from July 2006

Re: [svn:perl6-synopsis] r9727 - doc/trunk/design/syn

Thread Previous
From:
Larry Wall
Date:
July 1, 2006 13:15
Subject:
Re: [svn:perl6-synopsis] r9727 - doc/trunk/design/syn
Message ID:
20060701201433.GA17874@wall.org
On Sat, Jul 01, 2006 at 03:31:52PM +0300, Markus Laire wrote:
: On 7/1/06, larry@cvs.perl.org <larry@cvs.perl.org> wrote:
: >+In particular, these forms disable the lookahead for an adverbial 
: >argument,
: >+so while
: >+
: >+    q:n($foo)
: >+
: >+will misinterpret C<$foo> as the C<:n> argument,
: >+
: >+    qn(stuff)
: >+
: >+has the advantage of misinterpreting it as the argument to the C<qn()>
: >+function instead.  C<:)>
: >+
: >+But parens are special that way.  Other bracketing characters are special
: >+only if they can be mistaken for adverbial arguments, so
: >+
: >+    qn[stuff]
: >+
: >+is fine, while
: >+
: >+    q:n[stuff]
: >+
: >+is not.  Basically, just don't use parens for quote delimiters, and always
: >+put a space after your adverbs.
: 
: Why q:n[stuff] is not fine? Shouldn't that pass [stuff] to adverb n?

That's what it does.  But it's not fine if you expected [...] to
delimit the quoted string instead.

: Also, in what way are parens special?
: Doesn't qn(stuff) and qn[stuff] both mean same thing?

Nope, qn(stuff) is always a function call.  q(foo) is always a function
call, not a quote.

: And both q:n(stuff) and q:n[stuff] pass something to adverb n. (First
: passes stuff, second passes [stuff])

That is correct.  My intent with the quote declarator however is that
there be an implicit space after it, so the n on the end of qn no longer
functions as an adverb, at least in terms of looking for a subsequent
argument.  I will attempt to clarify the distinction between quotes
and ordinary macros.  Thanks.

Larry

Thread Previous


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