FWIW, the current proposal for aliasing blocks of ambient text is functional; it just feels a bit kludgey, and I'm a bit bothered by the fact that you can't alias any ambient text other than a code block.
On Wed, Aug 19, 2009 at 11:29 AM, Damian Conway<dam...@conway.org> wrote: > Jonathan "Dataweaver" Lang proposed: > >> OK. Let me propose an alternative (which I expect will be immediately >> shot down): > > BANG! > > ;-) D'oh! >> Allow '=begin alias', '=end alias', and '=for alias' as special cases: >> the Perl parser makes an exception for them and doesn't treat them as >> the start or end of POD Blocks, merely as single-line directives; but >> the Pod parser treats them as normal Pod Blocks, with the contents >> being attached to the alias. > > Well, clearly I'm not going to be in favour of introducing exceptions to > the general syntax. > > However, I had originally thought that we should have =alias and > =dealias directives to delimit code extractions. In the end I liked the > use of the code's own delimiters better, but I guess if people preferred > to have two directives as delimiters, we could consider that instead. What I liked the most about my proposal was that it allowed for a "blank line termination" form as well as an "explicit directive termination" form. On review, '=for alias' would have been redundant with '=alias' (although I don't think that redundancy hurts). And again, the Pod coder would be able to think in the same terms that he does for ordinary blocks. But assuming for the moment that the "pseudo-block" idea is off the table, how about saying that an ambient code alias is normally terminated by the next blank line or Pod directive (as per =for) unless you give it a :begin adverb, in which case it terminates with an appropriately nested =alias name :end directive: =alias outer :begin while (...) { =alias inner blah blah blah } =alias outer :end Unless there's some reason why adverbs don't work for =alias directives, that's fully consistent with normal syntax. OTOH, that's exactly what the problem would be, isn't it? '=alias outer :begin' would be parsed as an inline alias, where "outer" is equated with ":begin". So how about borrowing from your earlier example of numbered items, and identifying explicitly terminated blocks with a + or - immediately following the '=alias': =alias+ outer while (...) { =alias inner blah blah blah } =alias- outer I'm also considering a more radical possibility whereas the ambient code has a means of tagging portions of itself for Pod inclusion. I'll think it through some more and then offer a proposal. Still, I think that treating =alias as a block when it has only one argument, and as a directive when it has none or two, would be more user-friendly (though admittedly more hostile to the guy coding the Pod Parser) than any of these alternatives. > Let's see what others think. OK. -- Jonathan "Dataweaver" Lang