develooper Front page | perl.perl5.porters | Postings from July 2011

Re: [perl #93640] Allow comments in qw()

Thread Previous | Thread Next
Tom Christiansen
July 1, 2011 05:12
Re: [perl #93640] Allow comments in qw()
Message ID:
Zefram <> wrote
   on Fri, 01 Jul 2011 11:28:21 BST: 

>> We've already suffered enough from the problems of qr/.../'s trailing
>> modifier syntax:

> Indeed.  But because qw can already take almost any character as a
> delimiter, we can't really add a modifier at the beginning either.
> It'll have to be a new operator, qwx.  Which anyone interested can
> prototype in a CPAN module for Perl 5.11.2+.

You know, I have all *kinds* of constructs that work like ql(...),
qwx(...), etc, which I use *all* the time.  But I see no need to go
rewriting the language to turn them into keywords proper, with all the
attendant complexity and confusion.

    my $code = deQ<<'LITERAL' . deQQ<<"INTERPOLATED";
                |Q|   use utf8;
                |Q|   sub convert_to_superscripts (_) {
                |Q|       confess "argcount" unless @_ == 1;
                |Q|       my $string = $_[0];
                |Q|       confess "want string" if ref $_[0];
               |QQ|      \$string =~ tr[$originals][$superscripts];
               |QQ|       return \$string;
               |QQ|   }
               |QQ|   'ig00'

    eval $code || die;

Since it can be done with existing technology, why *shouldn't* it be?


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About