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

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

Thread Previous | Thread Next
From:
Tom Christiansen
Date:
July 1, 2011 05:12
Subject:
Re: [perl #93640] Allow comments in qw()
Message ID:
26630.1309522310@chthon
Zefram <zefram@fysh.org> 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|
                |Q|   use utf8;
                |Q|
                |Q|   sub convert_to_superscripts (_) {
                |Q|       confess "argcount" unless @_ == 1;
                |Q|       my $string = $_[0];
                |Q|       confess "want string" if ref $_[0];
LITERAL
               |QQ|
               |QQ|      \$string =~ tr[$originals][$superscripts];
               |QQ|       return \$string;
               |QQ|   }
               |QQ|
               |QQ|   'ig00'
               |QQ|
INTERPOLATED

    eval $code || die;


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

--tom

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About