Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

S02: generalized quotes and adverbs

7 views
Skip to first unread message

Jerry Gay

unread,
May 10, 2006, 2:15:24 AM5/10/06
to p6l
according to S02, under 'Literals', generalized quotes may now take
adverbs. in that section is the following comment:

<snip>
[Conjectural: Ordinarily the colon is required on adverbs, but the
"quote" declarator allows you to combine any of the existing adverbial
forms above without an intervening colon:

quote qw; # declare a P5-esque qw//
<snip>

there's trouble if both q (:single) and qq (:double) are allowed
together. how would qqq resolve? i say it makes sense that we get
longest-token matching first, which means it translates to :double
followed by :single.

~jerry

Larry Wall

unread,
May 10, 2006, 2:45:06 AM5/10/06
to p6l
On Tue, May 09, 2006 at 11:15:24PM -0700, jerry gay wrote:
: according to S02, under 'Literals', generalized quotes may now take

That would be one way to handle it. I'm not entirely convinced that
we have the right adverb set yet though. I'm still thinking about
turning :n, :q, and :qq into :0, :1, and :2. I'd like to turn :ww
into something single character as well. The doubled ones bother me
just a little.

But as it stands, the conjectured quote declarator is kind of lame.
It'd be just about as easy to allow

quote qX :x :y :z;

so you could alias it any way you like. Or possibly just allow

alias qX "q:x:y:z";

or even

qX ::= "q:x:y:z";

as a simple, argumentless "word" macro. But the relationship
of that to "real" macros would have to be evaluated. There's
something to be said for keeping macros a little bit klunky.
On the other hand, if people are going to invent simplified
macro syntax anyway, I'd rather there be some standards.

Larry

Daniel Hulme

unread,
May 10, 2006, 3:09:45 AM5/10/06
to perl6-l...@perl.org
> qX ::= "q:x:y:z";
>
> as a simple, argumentless "word" macro.
But would that DWIM when I come to write

qX(stuff, specifically not an adverb argument);

?

--
"The rules of programming are transitory; only Tao is eternal.
Therefore you must contemplate Tao before you receive enlightenment."
"How will I know when I have received enlightenment?" asked the novice.
"Your program will then run correctly," replied the master.

Larry Wall

unread,
May 11, 2006, 1:33:32 PM5/11/06
to perl6-l...@perl.org
On Wed, May 10, 2006 at 08:09:45AM +0100, Daniel Hulme wrote:
: > qX ::= "q:x:y:z";

: >
: > as a simple, argumentless "word" macro.
: But would that DWIM when I come to write
:
: qX(stuff, specifically not an adverb argument);
:
: ?

Just looking at it, I would expect qX() to call a function. Knowing the macro,
I'd expect it to do q :x :y :z() and then treat the ; as the delimiter, which
probably means the macro should have been written:

qX ::= "q:x:y:z ";

and then the qX() form either does "q:x:y:z ()" or calls the qX() function.
Which all probably means that we're still better off distinguishing quote
macros from "word" macros so that the intent is clear. A quote macro would
have no doubt: qX() always means to call the qX function, not the quoter.

Larry

0 new messages