Skip Menu |
Report information
Id: 127640
Status: rejected
Priority: 0/
Queue: perl5

Owner: Nobody
Requestors: LAWalsh <perl-diddler [at] tlinx.org>
Cc:
AdminCc:

Operating System: Linux
PatchStatus: (no value)
Severity: Wishlist
Type: core
Perl Version: 5.16.3
Fixed In: (no value)



Date: Tue, 1 Mar 2016 20:31:56 -0800
To: perlbug [...] perl.org
Subject: RFE: "qqw( $var/x $var/y word3 $var4=word4 )"
From: perl-diddler [...] tlinx.org
Download (untitled) / with headers
text/plain 4.5k
This is a bug report for perl from perl-diddler@tlinx.org, generated with the help of perlbug 1.39 running under perl 5.16.3. ----------------------------------------------------------------- [Please describe your issue here] Every once in a while, I start filling an array using "qw()", when I run into, not too infrequently, a desire to have a var or expression as a "word". Paths can be a good example: my short_paths=[ qw( sysfs sys_classes netclass sysmods) ]; my spth_vals =[qqw( /sys $sysfs/class $sys_classes/net $sysfs/module ) ]; -- or the standard config path depency chain: : ${prefix:=/} : ${bootprefix:=${prefix}} : ${eprefix:=${prefix}usr} : ${bindir=$eprefix/bin} : ${sbindir:=$eprefix/sbin} ... In the 1st example one would want to loop through short_paths, then assign corresponding spth_vals. Just as in any other list, terms are evaluated left-to-right. I wondered whether it was worth it keeping the "qqw" terms "simple", or allow any code option. -- or if something like "xw" would be used for "executable 'words'", so one could combine a path eval like: my ($sysfs, $sys_classes, $netclass, $sys_modules); my chk_paths=[ XW( $sysfs=/sys $sys_classes=$sysfs/class $netclass=$sys_classes/net $sys_modules=$sysfs/module)]; (Xw = liberal "qqw" or Xw=more specific "xw" --- though not sure of the latter's benefits, off hand). Anyway, am I just missing this feature, or is it something that might make sense since on the perlop page, it seems word list not allowing interpolation begs for a form that would. Is there any reason wny it would be a good idea? [Please do not change anything below this line] ----------------------------------------------------------------- --- Flags: category=core severity=wishlist --- Site configuration information for perl 5.16.3: Configured by law at Wed Jan 22 12:58:58 PST 2014. Summary of my perl5 (revision 5 version 16 subversion 3) configuration: Platform: osname=linux, osvers=3.12.0-isht-van, archname=x86_64-linux-thread-multi-ld uname='linux ishtar 3.12.0-isht-van #1 smp preempt wed nov 13 16:50:51 pst 2013 x86_64 x86_64 x86_64 gnulinux ' config_args='' hint=previous, useposix=true, d_sigaction=define useithreads=define, usemultiplicity=define useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef use64bitint=define, use64bitall=define, uselongdouble=define usemymalloc=n, bincompat5005=undef Compiler: cc='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', optimize='-g -O2', cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64' ccversion='', gccversion='4.8.1 20130909 [gcc-4_8-branch revision 202388]', gccosandvers='' intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16 ivtype='long', ivsize=8, nvtype='long double', nvsize=16, Off_t='off_t', lseeksize=8 alignbytes=16, prototype=define Linker and Libraries: ld='gcc', ldflags ='-g -fstack-protector -fPIC' libpth=/usr/lib64 /lib64 libs=-lnsl -lndbm -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc -lgdbm_compat perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc libc=/lib/libc-2.18.so, so=so, useshrplib=true, libperl=libperl-5.16.3.so gnulibc_version='2.18' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E -Wl,-rpath,/home/perl/perl-5.16.3/lib/x86_64-linux-thread-multi-ld/CORE' cccdlflags='-fPIC', lddlflags='-shared -g -O2 -fstack-protector -fPIC' Locally applied patches: --- @INC for perl 5.16.3: /home/law/bin/lib /home/perl/perl-5.16.3/lib/site/x86_64-linux-thread-multi-ld /home/perl/perl-5.16.3/lib/site /home/perl/perl-5.16.3/lib/x86_64-linux-thread-multi-ld /home/perl/perl-5.16.3/lib . --- Environment for perl 5.16.3: HOME=/home/law LANG=en_US.utf8 LANGUAGE (unset) LC_COLLATE=C LC_CTYPE=en_US.UTF-8 LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=/sbin:.::/home/law/bin:/usr/local/bin:/usr/bin:/bin:/usr/games:/opt/kde3/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin:/usr/sbin:/etc/local/func_lib:/home/law/lib:/home/law/bin/lib PERL5OPT=-Mutf8 -CSA -I/home/law/bin/lib PERL_BADLANG (unset) SHELL=/bin/bash
Date: Wed, 2 Mar 2016 09:03:15 +0100
To: perl5-porters [...] perl.org
From: Lukas Mai <plokinom [...] gmail.com>
Subject: Re: [perl #127640] RFE: "qqw( $var/x $var/y word3 $var4=word4 )"
Download (untitled) / with headers
text/plain 616b
Am 02.03.2016 um 05:32 schrieb Linda Walsh (via RT): Show quoted text
> > Every once in a while, I start filling an array using > "qw()", when I run into, not too infrequently, a desire > to have a var or expression as a "word". Paths can be > a good example: > > my short_paths=[ qw( sysfs sys_classes netclass sysmods) ]; > my spth_vals =[qqw( /sys $sysfs/class $sys_classes/net $sysfs/module ) ];
It's not core perl, but Quote::Code (available for perl 5.14+) lets you write this: use Quote::Code; my $pth_vals = [qcw( /sys {$sysfs}/class {$sys_classes}/net {$sysfs}/module )]; -- Lukas Mai <plokinom@gmail.com>
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 1021b
On Wed Mar 02 00:03:42 2016, plokinom@gmail.com wrote: Show quoted text
> Am 02.03.2016 um 05:32 schrieb Linda Walsh (via RT):
> > > > Every once in a while, I start filling an array using > > "qw()", when I run into, not too infrequently, a desire > > to have a var or expression as a "word". Paths can be > > a good example: > > > > my short_paths=[ qw( sysfs sys_classes netclass > > sysmods) ]; > > my spth_vals =[qqw( /sys $sysfs/class > > $sys_classes/net $sysfs/module ) ];
> > It's not core perl, but Quote::Code (available for perl 5.14+) lets > you > write this: > > use Quote::Code; > my $pth_vals = [qcw( > /sys {$sysfs}/class {$sys_classes}/net {$sysfs}/module > )];
Also, if you *know* that your strings contain no wildcards, you can do <foo bar $baz> (or </sys $sysfs/class $sys_classes/net $sysfs/module>), and it won’t even go out to the filesystem, though it is marginally slower than qw and Quote::Code (at least in theory; I have not measured it). -- Father Chrysostomos
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 414b
On Wed Mar 02 00:03:42 2016, plokinom@gmail.com wrote: Show quoted text
> It's not core perl, but Quote::Code (available for perl 5.14+) lets > you > write this:....
--- Yeah, I could think of a few ways to do it "manually", but none with the reliability or orthogonal grace of "q"/"qq" => "qw"/"??". It seemed like one of those things that looked like it was missing rather than needing an extension or clever work-workaround.
Subject: Re: [perl #127640] RFE: "qqw( $var/x $var/y word3 $var4=word4 )"
Date: Sat, 5 Mar 2016 13:14:28 -0500
From: Ricardo Signes <perl.p5p [...] rjbs.manxome.org>
To: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 492b
* Linda Walsh <perlbug-followup@perl.org> [2016-03-01T23:32:14] Show quoted text
> Every once in a while, I start filling an array using > "qw()", when I run into, not too infrequently, a desire > to have a var or expression as a "word". Paths can be > a good example:
$x = "good job"; @y = qqw( $x hunter ); Is @y now ('good', 'job', 'hunter') or ('good job', 'hunter')? I would think the latter. I think that many Perl programmers have wished for qqw at one time or another, me included. -- rjbs
Download signature.asc
application/pgp-signature 473b

Message body not shown because it is not plain text.

RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 635b
On Sat Mar 05 10:14:48 2016, perl.p5p@rjbs.manxome.org wrote: Show quoted text
> * Linda Walsh <perlbug-followup@perl.org> [2016-03-01T23:32:14]
> > Every once in a while, I start filling an array using > > "qw()", when I run into, not too infrequently, a desire > > to have a var or expression as a "word". Paths can be > > a good example:
> > $x = "good job"; > @y = qqw( $x hunter ); > > Is @y now ('good', 'job', 'hunter') or ('good job', 'hunter')? I > would think > the latter.
I would have assumed the former. So I suppose it’s not obvious. BTW, this does the former: $x = "good job"; @y = < $x hunter >; -- Father Chrysostomos
Subject: Re: [perl #127640] RFE: "qqw( $var/x $var/y word3 $var4=word4 )"
CC: Perl5 Porters <perl5-porters [...] perl.org>
From: Eirik Berg Hanssen <Eirik-Berg.Hanssen [...] allverden.no>
To: "perlbug-followup [...] perl.org" <perlbug-followup [...] perl.org>
Date: Sat, 5 Mar 2016 22:29:15 +0100
Download (untitled) / with headers
text/plain 808b

On Sat, Mar 5, 2016 at 8:06 PM, Father Chrysostomos via RT <perlbug-followup@perl.org> wrote:
Show quoted text
> $x = "good job";
> @y = qqw( $x hunter );
>
> Is @y now ('good', 'job', 'hunter') or ('good job', 'hunter')?  I
> would think
> the latter.

I would have assumed the former.  So I suppose it’s not obvious.  BTW, this does the former:

  $x = "good job";
  @y = < $x hunter >;

  In Perl6, this does the former, too:

eirik@purplehat[22:25:34]~$ perl6 -e 'my $x = "good job"; my @y = « $x hunting »; .say for @y'
good
job
hunting
eirik@purplehat[22:25:42]~$

  … which surprised me, until I found that this does the latter:

eirik@purplehat[22:27:52]~$ perl6 -e 'my $x = "good job"; my @y = « "$x" hunting »; .say for @y'
good job
hunting
eirik@purplehat[22:27:56]~$

 :)


Eirik
Date: Sat, 5 Mar 2016 22:59:38 +0100
From: Aristotle Pagaltzis <pagaltzis [...] gmx.de>
To: perl5-porters [...] perl.org
Subject: Re: [perl #127640] RFE: "qqw( $var/x $var/y word3 $var4=word4 )"
Download (untitled) / with headers
text/plain 1.5k
* Father Chrysostomos via RT <perlbug-followup@perl.org> [2016-03-05 20:10]: Show quoted text
> On Sat Mar 05 10:14:48 2016, perl.p5p@rjbs.manxome.org wrote:
> > $x = "good job"; > > @y = qqw( $x hunter ); > > > > Is @y now ('good', 'job', 'hunter') or ('good job', 'hunter')? > > I would think the latter.
> > I would have assumed the former. So I suppose it’s not obvious. BTW, > this does the former: > > $x = "good job"; > @y = < $x hunter >;
I prefer the former. So much so, in fact, that I don’t see any point in the feature if it does the latter. Because that result is already easy to achieve in several ways – starting with this very conventional, very boring, nobody-will-ever-scratch-their-head-about-it approach: @y = split ' ', "$x hunter"; But a list in which variable values are interpolated yet atomic requires lots of syntactic ceremony using currently available means: @subdir = ( "$prefix/foo", "$prefix/bar", "$prefix/baz" ); Consider how much nicer that would be if you got to leave out all those quotes and separators: @subdir = qqw( $prefix/foo $prefix/bar $prefix/baz ); A qqw() that splits after interpolating would deprive us of that. So I think it must work that way or else there’s no point in bothering. While we’re at it – I would also prefer qqw() to allow comments, and/but allow backslashing whitespace and octothorpes to demote them from syntax to string content. Oh, and please – no qw()-style warnings about commas. Regards, -- Aristotle Pagaltzis // <http://plasmasturm.org/>
Date: Sat, 5 Mar 2016 23:07:16 +0100
From: Aristotle Pagaltzis <pagaltzis [...] gmx.de>
To: perl5-porters [...] perl.org
Subject: Argh, correction [Re: [perl #127640]]
Download (untitled) / with headers
text/plain 772b
* Aristotle Pagaltzis <pagaltzis@gmx.de> [2016-03-05 23:00]: Show quoted text
> * Father Chrysostomos via RT <perlbug-followup@perl.org> [2016-03-05 20:10]:
> > On Sat Mar 05 10:14:48 2016, perl.p5p@rjbs.manxome.org wrote:
> > > $x = "good job"; > > > @y = qqw( $x hunter ); > > > > > > Is @y now ('good', 'job', 'hunter') or ('good job', 'hunter')? > > > I would think the latter.
> > > > I would have assumed the former. So I suppose it’s not obvious. BTW, > > this does the former: > > > > $x = "good job"; > > @y = < $x hunter >;
> > I prefer the former. So much so, in fact, that I don’t see any point in > the feature if it does the latter.
(I meant that I prefer the *latter* – as the rest of the message should make clear – and that I see the *former* as pointless.)
CC: pp Porters <perl5-porters [...] perl.org>
From: Kent Fredric <kentfredric [...] gmail.com>
To: Aristotle Pagaltzis <pagaltzis [...] gmx.de>
Date: Sun, 6 Mar 2016 18:18:57 +1300
Subject: Re: [perl #127640] RFE: "qqw( $var/x $var/y word3 $var4=word4 )"
Download (untitled) / with headers
text/plain 2.3k
On 6 March 2016 at 10:59, Aristotle Pagaltzis <pagaltzis@gmx.de> wrote: Show quoted text
> * Father Chrysostomos via RT <perlbug-followup@perl.org> [2016-03-05 20:10]:
>> On Sat Mar 05 10:14:48 2016, perl.p5p@rjbs.manxome.org wrote:
>> > $x = "good job"; >> > @y = qqw( $x hunter ); >> > >> > Is @y now ('good', 'job', 'hunter') or ('good job', 'hunter')? >> > I would think the latter.
>> >> I would have assumed the former. So I suppose it’s not obvious. BTW, >> this does the former: >> >> $x = "good job"; >> @y = < $x hunter >;
> > I prefer the former. So much so, in fact, that I don’t see any point in > the feature if it does the latter. Because that result is already easy > to achieve in several ways – starting with this very conventional, very > boring, nobody-will-ever-scratch-their-head-about-it approach: > > @y = split ' ', "$x hunter"; > > But a list in which variable values are interpolated yet atomic requires > lots of syntactic ceremony using currently available means: > > @subdir = ( "$prefix/foo", "$prefix/bar", "$prefix/baz" ); > > Consider how much nicer that would be if you got to leave out all those > quotes and separators: > > @subdir = qqw( $prefix/foo $prefix/bar $prefix/baz ); > > A qqw() that splits after interpolating would deprive us of that. > > So I think it must work that way or else there’s no point in bothering. > > While we’re at it – I would also prefer qqw() to allow comments, and/but > allow backslashing whitespace and octothorpes to demote them from syntax > to string content. Oh, and please – no qw()-style warnings about commas. > > Regards,
What would this do?: $prefix = "/some/path/with a space/"; @y = qqw{ $prefix/hunter $prefix/bar }; Your description so far indicates that the output would be ( '/some/path/with' , 'a' , 'space/hunter' ) etc. For clarity, we need a description of the 2 behaviours other than "former" or "Latter" because backtracking to work out which one we're talking about is kinda confusing. expanding-qqw: variables with spaces in them are interpolated into being lists preserving-qqw: variables with spaces in them are treated as syntactically atomic and indivisible, and any spaces in them are treated as non-spaces for the purpose of the qqw construct, and only literal spaces in qqw itself is a separator -- Kent KENTNL - https://metacpan.org/author/KENTNL
Date: Sun, 6 Mar 2016 10:18:43 +0100
To: perl5-porters [...] perl.org
From: Aristotle Pagaltzis <pagaltzis [...] gmx.de>
Subject: Re: [perl #127640] RFE: "qqw( $var/x $var/y word3 $var4=word4 )"
Download (untitled) / with headers
text/plain 1.5k
* Kent Fredric <kentfredric@gmail.com> [2016-03-06 06:20]: Show quoted text
> On 6 March 2016 at 10:59, Aristotle Pagaltzis <pagaltzis@gmx.de> wrote:
> > […]
> > What would this do?: > > $prefix = "/some/path/with a space/"; > @y = qqw{ $prefix/hunter $prefix/bar }; > > Your description so far indicates that the output would be > > ( '/some/path/with' , 'a' , 'space/hunter' )
Sorry for the confusion. If you ignore the opening prose and concentrate on the examples, they will show you what I intended, but since I screwed that up, let me restate my position for clarity. This line: qqw( $prefix/foo $prefix/bar $prefix/baz ); … ought to yield the same result as this line: ( "$prefix/foo", "$prefix/bar", "$prefix/baz" ); … and *not* as this line: split ' ', "$prefix/foo $prefix/bar $prefix/baz"; … because that last line is already real easy to write in various ways that allow low-ceremony syntax for larger lists. E.g. for larger lists, split ' ', qq( $prefix/foo $prefix/bar $prefix/baz $prefix/quux $prefix/qux ... ); There’s little point in adding yet another way of writing that, when the other kind of result incurs a per-item punctuation tax: ( "$prefix/foo", "$prefix/bar", "$prefix/baz", "$prefix/quux", "$prefix/qux", # ... ); (And that’s the least noisy way of formatting it.) So that is the case that ought to gain some syntactic relief, if any. Hope I did a better job this time. Regards, -- Aristotle Pagaltzis // <http://plasmasturm.org/>
From: Kent Fredric <kentfredric [...] gmail.com>
To: Aristotle Pagaltzis <pagaltzis [...] gmx.de>
Date: Sun, 6 Mar 2016 22:40:57 +1300
CC: pp Porters <perl5-porters [...] perl.org>
Subject: Re: [perl #127640] RFE: "qqw( $var/x $var/y word3 $var4=word4 )"
Download (untitled) / with headers
text/plain 1.1k
On 6 March 2016 at 22:18, Aristotle Pagaltzis <pagaltzis@gmx.de> wrote: Show quoted text
> There’s little point in adding yet another way of writing that, when the > other kind of result incurs a per-item punctuation tax: > > ( > "$prefix/foo", > "$prefix/bar", > "$prefix/baz", > "$prefix/quux", > "$prefix/qux", > # ... > ); > > (And that’s the least noisy way of formatting it.) > > So that is the case that ought to gain some syntactic relief, if any. > > Hope I did a better job this time.
Agreed, so we are both proponents of "preserving"-qqw. Show quoted text
> preserving-qqw: variables with spaces in them are treated as > syntactically atomic and indivisible, and any spaces in them are > treated as non-spaces for the purpose of the qqw construct, and only >literal spaces in qqw itself is a separator
The only residual question I have is, what does this do: @x = ('word','word with space'); @z = qqw( @x not-touching @{x}touching ); I assume that the "most obvious" thing would be this to compile the same as: @z = ( "@x", "not-touching", "@{x}touching", ); -- Kent KENTNL - https://metacpan.org/author/KENTNL
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 2.8k
I'm going to point out that Perl 6 has a vastly different way of parsing strings that only looks like the Perl 5 way. On Sat Mar 05 13:29:44 2016, Eirik-Berg.Hanssen@allverden.no wrote: Show quoted text
> On Sat, Mar 5, 2016 at 8:06 PM, Father Chrysostomos via RT < > perlbug-followup@perl.org> wrote: >
> > > $x = "good job"; > > > @y = qqw( $x hunter ); > > > > > > Is @y now ('good', 'job', 'hunter') or ('good job', 'hunter')? I > > > would think > > > the latter.
> > > > I would have assumed the former. So I suppose it’s not obvious. BTW, > > this does the former: > > > > $x = "good job"; > > @y = < $x hunter >;
> > > In Perl6, this does the former, too: > > eirik@purplehat[22:25:34]~$ perl6 -e 'my $x = "good job"; my @y = « $x > hunting »; .say for @y' > good > job > hunting > eirik@purplehat[22:25:42]~$ > > … which surprised me, until I found that this does the latter: > > eirik@purplehat[22:27:52]~$ perl6 -e 'my $x = "good job"; my @y = « "$x" > hunting »; .say for @y' > good job > hunting > eirik@purplehat[22:27:56]~$ > > :) > > > Eirik
First off `< ... >` is the same as `qw/ ... /`, and `« ... »` is the same as `qqww/ ... /` Perl 6 starts off with a zero feature quoting mechanism `Q/ ... /` `「 ... 」` then adds features to it ( That is it doesn't even support backslashing the character used for quoting ) Then there is `'...'` `q/.../` `Q:q/.../` `Q:single/.../` which enables backslashing backslashes and the quoting character `:qq` / `:double` enables `:c` / `:closure`, `:s` / `:scalar`, `:a` / `:array`, `:h` / `:hash`, `:f` / `:function` `:w` / `:words` splits on whitespace ( depends on a unicode property ) `:ww` / `:quotewords` splits on whitespace, but takes into consideration quotes Some combinations can be combined without the colons like `qqww/.../` `qx/.../` `qqx/.../` ( basically one base construct `Q`,`q`,`qq` and one other adverb ) There are several other features that can also be enabled like `:to` for heredocs Basically `<< ... >>` / `« ... »` is short for `qqww /.../` `qq :ww /.../` `Q :qq :ww /.../` `Q :double :quotewords /.../` `Q :closure :scalar :array :hash :function :quotewords /.../` `Q :closure(True) :scalar(True) :array(True) :hash(True) :function(True) :quotewords(True) /.../` The spaces between adverbs (feature flags) are optional. The relevant bit for this discussion: use v6.c; my $x = 'Foo Bar'; say qqww/ $x World /.perl; # ("Foo", "Bar", "World") say qqww/ "$x" World /.perl; # ("Foo Bar", "World") say qqww/ '$x World' /.perl; # "Foo Bar World" # :words not :quotewords say qqw/ '$x World' /.perl; # ("'Foo", "Bar", "World'") # ignores quotes inside of the embedded string $x = "'Foo Bar' Baz"; say qqww/ $x World /.perl; # ("'Foo", "Bar'", "Baz", "World") ( Again you could use `<< ... >>` or `« ... »` instead of `qqww/.../` ) Perhaps there should be qw// qqw// qww// qqww//
To: Aristotle Pagaltzis <pagaltzis [...] gmx.de>
From: Ricardo Signes <perl.p5p [...] rjbs.manxome.org>
Date: Thu, 10 Mar 2016 19:00:53 -0500
CC: perl5-porters [...] perl.org
Subject: Re: [perl #127640] RFE: "qqw( $var/x $var/y word3 $var4=word4 )"
* Aristotle Pagaltzis <pagaltzis@gmx.de> [2016-03-05T16:59:38] Show quoted text
> > On Sat Mar 05 10:14:48 2016, perl.p5p@rjbs.manxome.org wrote:
> > > $x = "good job"; > > > @y = qqw( $x hunter ); > > > > > > Is @y now ('good', 'job', 'hunter') or ('good job', 'hunter')? > > > I would think the latter.
> >
> I prefer the [latter].
Me, too. Other cases to consider: @x = qqw( abc @def ghi ); ...which would need to have three elements, to match this: @x = qqw( x:abc x:@def x:ghi ); It would be bizarre for the second example to only have x: on the first element from @def. If @def is empty, it ought to become "", similarly. Someone will probably have to stop and think about: @x = qqw( abc $def->{ ... ... ... } ghi ); ...because of the spaces in the expr in the second element. I think this is okay. Show quoted text
> While we’re at it – I would also prefer qqw() to allow comments, and/but > allow backslashing whitespace and octothorpes to demote them from syntax > to string content.
Agreed. Show quoted text
> Oh, and please – no qw()-style warnings about commas.
I have no feelings on this. -- rjbs
Download signature.asc
application/pgp-signature 473b

Message body not shown because it is not plain text.

RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 2.5k
On Thu Mar 10 16:01:19 2016, perl.p5p@rjbs.manxome.org wrote: Show quoted text
> * Aristotle Pagaltzis <pagaltzis@gmx.de> [2016-03-05T16:59:38]
> > > On Sat Mar 05 10:14:48 2016, perl.p5p@rjbs.manxome.org wrote:
> > > > $x = "good job"; > > > > @y = qqw( $x hunter ); > > > > > > > > Is @y now ('good', 'job', 'hunter') or ('good job', 'hunter')? > > > > I would think the latter.
> > >
> > I prefer the [latter].
> > Me, too. Other cases to consider: > > @x = qqw( abc @def ghi ); > > ...which would need to have three elements, to match this: > > @x = qqw( x:abc x:@def x:ghi ); > > It would be bizarre for the second example to only have x: on the > first element > from @def. If @def is empty, it ought to become "", similarly.
Would you please clarify with examples? Does x:@def above become one element of @x, or does it fill @x with as many elements as are in @def? Show quoted text
> > Someone will probably have to stop and think about: > > @x = qqw( > abc > $def->{ ... ... ... } > ghi > ); > > ...because of the spaces in the expr in the second element. I think > this is > okay.
You just switch to a different parsing style when you encounter the $. Standard double-quote parsing solves it that way. <wishful thinking> That said, I wish we could solve this kind of nonsense: qq<$x{">"}>; # syntax error If strings were parsed just like blocks of code, there would be no reason for that not to work. After all, { "}" } and ["]"] work. As it is, the final delimiter of the string is searched for before the body is parsed. It has to be that way for quote-like operators with flags at the end. It would have been saner if the parsing had been done the other way round from day 1 (with the flags in some other spot). Would it be possible to make qqw work the ‘new’ way? Or would it be to confusing if it does not conform to the way qw works? </wishful> Show quoted text
>
> > While we’re at it – I would also prefer qqw() to allow comments, > > and/but > > allow backslashing whitespace and octothorpes to demote them from > > syntax > > to string content.
> > Agreed. >
> > Oh, and please – no qw()-style warnings about commas.
> > I have no feelings on this.
That is one of the most annoying warnings. If it warned *only* when all the elements are comma-separated, it would be helpful for new bees without annoying people trying to do this: qw( . , ; : ) etc. Currently, just *one* comma anywhere in the qw will raise the warning. If we could restrict the warning that way, I would not mind it on qqw. It might be good to apply the restriction to qw as well. -- Father Chrysostomos
Subject: Re: [perl #127640] RFE: "qqw( $var/x $var/y word3 $var4=word4 )"
To: Father Chrysostomos via RT <perlbug-followup [...] perl.org>
From: Ricardo Signes <perl.p5p [...] rjbs.manxome.org>
Date: Fri, 11 Mar 2016 09:34:48 -0500
CC: ;, perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 859b
* Father Chrysostomos via RT <perlbug-followup@perl.org> [2016-03-11T00:52:04] Show quoted text
> On Thu Mar 10 16:01:19 2016, perl.p5p@rjbs.manxome.org wrote:
> > @x = qqw( x:abc x:@def x:ghi ); > > > > It would be bizarre for the second example to only have x: on the first > > element from @def. If @def is empty, it ought to become "", similarly.
> > Would you please clarify with examples? Does x:@def above become one element > of @x, or does it fill @x with as many elements as are in @def?
I mean that, given @def=(1,2,3), @x would be: ("x:abc", "x:1 2 3", "x:ghi") Show quoted text
> > That said, I wish we could solve this kind of nonsense: > > qq<$x{">"}>; # syntax error > [...] > Would it be possible to make qqw work the ‘new’ way? Or would it be to > confusing if it does not conform to the way qw works? >
I think it would be too confusing. :( -- rjbs
Download signature.asc
application/pgp-signature 473b

Message body not shown because it is not plain text.

To: Ricardo Signes <perl.p5p [...] rjbs.manxome.org>
From: Abigail <abigail [...] abigail.be>
Date: Wed, 23 Mar 2016 18:46:21 +0100
Subject: Re: [perl #127640] RFE: "qqw( $var/x $var/y word3 $var4=word4 )"
CC: Aristotle Pagaltzis <pagaltzis [...] gmx.de>, perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 653b
On Thu, Mar 10, 2016 at 07:00:53PM -0500, Ricardo Signes wrote: Show quoted text
> * Aristotle Pagaltzis <pagaltzis@gmx.de> [2016-03-05T16:59:38]
> > > On Sat Mar 05 10:14:48 2016, perl.p5p@rjbs.manxome.org wrote:
> > > > $x = "good job"; > > > > @y = qqw( $x hunter ); > > > > > > > > Is @y now ('good', 'job', 'hunter') or ('good job', 'hunter')? > > > > I would think the latter.
> > >
> > I prefer the [latter].
> > Me, too. >
Do we have to make a choice? If someone is going through the trouble of implementing qqw() (or something similar named), why not introduce two constructs, one for each option? Then the user can use whatever he/she needs. Abigail
Date: Wed, 23 Mar 2016 21:22:08 +0100
From: Aristotle Pagaltzis <pagaltzis [...] gmx.de>
To: perl5-porters [...] perl.org
Subject: Re: [perl #127640] RFE: "qqw( $var/x $var/y word3 $var4=word4 )"
Download (untitled) / with headers
text/plain 920b
* Abigail <abigail@abigail.be> [2016-03-23 18:50]: Show quoted text
> On Thu, Mar 10, 2016 at 07:00:53PM -0500, Ricardo Signes wrote:
> > * Aristotle Pagaltzis <pagaltzis@gmx.de> [2016-03-05T16:59:38]
> > > > On Sat Mar 05 10:14:48 2016, perl.p5p@rjbs.manxome.org wrote:
> > > > > $x = "good job"; > > > > > @y = qqw( $x hunter ); > > > > > > > > > > Is @y now ('good', 'job', 'hunter') or ('good job', 'hunter')? > > > > > I would think the latter.
> > > >
> > > I prefer the [latter].
> > > > Me, too.
> > Do we have to make a choice? If someone is going through the trouble > of implementing qqw() (or something similar named), why not introduce > two constructs, one for each option? Then the user can use whatever > he/she needs.
IMO the other option already has an existing construct: split ' ', qq( ... ) Do you consider that not good enough for some reason? Regards, -- Aristotle Pagaltzis // <http://plasmasturm.org/>
Date: Wed, 23 Mar 2016 22:06:12 +0100
To: Aristotle Pagaltzis <pagaltzis [...] gmx.de>
From: Abigail <abigail [...] abigail.be>
CC: perl5-porters [...] perl.org
Subject: Re: [perl #127640] RFE: "qqw( $var/x $var/y word3 $var4=word4 )"
Download (untitled) / with headers
text/plain 1.5k
On Wed, Mar 23, 2016 at 09:22:08PM +0100, Aristotle Pagaltzis wrote: Show quoted text
> * Abigail <abigail@abigail.be> [2016-03-23 18:50]:
> > On Thu, Mar 10, 2016 at 07:00:53PM -0500, Ricardo Signes wrote:
> > > * Aristotle Pagaltzis <pagaltzis@gmx.de> [2016-03-05T16:59:38]
> > > > > On Sat Mar 05 10:14:48 2016, perl.p5p@rjbs.manxome.org wrote:
> > > > > > $x = "good job"; > > > > > > @y = qqw( $x hunter ); > > > > > > > > > > > > Is @y now ('good', 'job', 'hunter') or ('good job', 'hunter')? > > > > > > I would think the latter.
> > > > >
> > > > I prefer the [latter].
> > > > > > Me, too.
> > > > Do we have to make a choice? If someone is going through the trouble > > of implementing qqw() (or something similar named), why not introduce > > two constructs, one for each option? Then the user can use whatever > > he/she needs.
> > IMO the other option already has an existing construct: > > split ' ', qq( ... ) > > Do you consider that not good enough for some reason?
First of all, I don't have a strong need for qqw, regardless of what meaning is given to it. But I can see some value in either of the discussed meanings. I just want to point out there's also the possibility to add more than one construct. As for the "but here's a way to do it" argument, I don't find that a very convincing argument. qw can be expressed as split ' ', q (...) but does that mean qw() is a waste? Also, the variant you favour can also be easily expressed otherwise: @y = ($x, "hunter"); so that would argue to not implement qqw at all. Nor 99% of the other features which are being proposed. Abigail
Subject: Re: [perl #127640] RFE: "qqw( $var/x $var/y word3 $var4=word4 )"
From: Zefram <zefram [...] fysh.org>
Date: Fri, 15 Dec 2017 07:12:27 +0000
To: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 297b
The proposed qqw() should be implemented on CPAN first. If experience with that shows it to be popular, then we could consider adopting it into the core. There's no justification here for implementing it in the core without seeing such a prototype first. This ticket should be closed. -zefram
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 466b
On Thu, 14 Dec 2017 23:13:43 -0800, zefram@fysh.org wrote: Show quoted text
> The proposed qqw() should be implemented on CPAN first. If experience > with that shows it to be popular, then we could consider adopting it into > the core. There's no justification here for implementing it in the core > without seeing such a prototype first. This ticket should be closed.
Agreed. Examples of other examples: https://metacpan.org/pod/Quote::Code https://metacpan.org/pod/Quote::Ref


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org