[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Macro + diversion issue

From: Daniel Richard G.
Subject: Re: Macro + diversion issue
Date: Tue, 22 May 2007 01:14:54 -0400

On Mon, 2007 May 21 21:45:43 -0600, Eric Blake wrote:
> I'm debating if some other solution might also be helpful, such as a
> builtin that adds an extra set of quotes only if it is called while
> currently parsing the arguments to a macro.  And it is also worth
> considering the proposal for a qindir() builtin in the TODO file.

Automatic quoting... so that you could then safely use regular divert() in 
a potential quoted-or-not arg-collection context?

I'd point out that the times you would really want to use regular divert() 
(so far as I'm aware) are when you're sending a huge amount of text to the 
diversion (so that it doesn't have to be all arg-collected), or you want 
the diversion switch to be persistent---and you normally wouldn't expect 
either of these inside mere macro arguments.

(Re qindir(), I don't see how that would be useful here if we had it...)

> But so far, it still seems like your solution of expanding the divert
> builtin to take a second argument of text that will be output to the
> specified diversion seems pretty slick.  I'm not so sure about reverting
> back to the current diversion, mainly because it seems weird for
> divert(1,) to behave differently than divert(1), particularly in light of
> POSIX rules that extra arguments should be ignored.

Good point. In that case, I think it would be better to have a new/separate 
builtin... the "doesn't change the current diversion" bit was actually the 
second bird to my one stone. I'd *really* like to do away with the need to 
save the current divnum so that you can then switch back afterward. I think 
most use cases of the new builtin would not want the diversion switch to 
stick, and if they do, it's easier to just call regular divert() afterward 
than to implement the whole pushdef(`saveDiv', divnum) rigmarole.

(As for what such a new builtin would be called, FWIW, I'm not at all proud 
of "sendtodiv"...)


NAME   = Daniel Richard G.       ##  Remember, skunks       _\|/_  meef?
EMAIL1 = address@hidden        ##  don't smell bad---    (/o|o\) /
EMAIL2 = address@hidden      ##  it's the people who   < (^),>
WWW    = http://www.******.org/  ##  annoy them that do!    /   \
(****** = site not yet online)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]