On Fri, Dec 06, 2002 at 03:24:44PM +1100, Damian Conway wrote:
> Larry was certainly in favour of it when he wrote A5
> (see under http://search.cpan.org/perl6/apo/A05.pod#Backslash_Reform).
> Except the separators he suggests are semicolons:
> 
>     Perl 5              Perl 6
>     \x0a\x0d            \x[0a;0d]               # CRLF
>     \x0a\x0d            \c[CR;LF]               # CRLF (conjectural)

I just had this thought - can I interpolate in there?

Something like
"\c[$(call_a_func())]"

and I interpolate the string returned by call_a_func() using whatever
interpolation system it finds itself in. (so the same function could
create the literal control characters if it finds itself in "\c[...]", or
the pretty-printed version if it finds itself within "\\c[...]"

I'm not sure if this is useful - I think its only benefit is to save a
string eval occasionally, with the downside of being obscure, complicating
understanding (interpolation becomes run time rather than compile time if
it's non-constant), and possibly the implementation.

[No I'm not smoking anything. I'm drinking tea today. Maybe it's just side
effects of over-exposure to london.pm yesterday, or reading Damian's book
(If it moves^Wis a reference - bless it! :-))]

Nicholas Clark

PS Time for a second edition:
   perl5.8.0 -lwe 'format FOO = ' -e '.' -e '$a = *FOO{FORMAT}; print ref $a'
FORMAT

Reply via email to