Jon Lang writes:
> FWIW, the current proposal for aliasing blocks of ambient text is
> functional; it just feels a bit kludgey,
Why? To me it seems the opposite: what could be more natural for
delimiting a block of code than braces?
> and I'm a bit bothered by the fact that you can't alias any ambient
> text other than a code block.
"Can't" is a bit strong: it's more that if you want to quote an
arbitrary portion of code then you need to add some braces around it.
But those braces are unlikely to harm the program.
The exception is if you want to quote an 'unbalanced' portion of code,
for example the start of a loop but not the entire loop. Do you
consider that to be likely?
> how about saying that an ambient code alias is normally
> terminated by the next blank line or Pod directive (as per =for)
Braces are more robust than blank lines; if aliasing a brace-delimited
block I may unthinkingly edit it to have a blank line in the middle of
it, on the basis that the blank line isn't significant to perl.
(Whereas if I edit the braces then I've changed the program as well as
An alternative would be to have blank-line termination for an alias
which _doesn't_ start with a brace (that is, doesn't have an opening
brace on the following non-blank line). However that would likely
confuse somebody who happens to add a brace to the line following the
alias directive (perhaps inside a quoted string, or changing the
brackets on a hash look-up, or in a regex) and unwittingly changes the
alias from several lines to just a few characters in the middle of that
Terminating at a Pod directive sounds plausible, unless anybody can
think of a good reason to be quoting Pod as part of code?
> > Let's see what others think.
I like the braces. I suggest initially only providing for braces, but
with the possibility of later adding options to indicate other
termination points if in practice there turn out to be many situations
where the braces don't work well.