Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation for split uses single quotes for PATTERN parameter #14802

Open
p5pRT opened this issue Jul 13, 2015 · 3 comments
Open

Documentation for split uses single quotes for PATTERN parameter #14802

p5pRT opened this issue Jul 13, 2015 · 3 comments

Comments

@p5pRT
Copy link

p5pRT commented Jul 13, 2015

Migrated from rt.perl.org#125605 (status was 'open')

Searchable as RT125605$

@p5pRT
Copy link
Author

p5pRT commented Jul 13, 2015

From the.rob.dixon@gmail.com

This is a bug report for perl from the.rob.dixon@​gmail.com,
generated with the help of perlbug 1.40 running under perl 5.22.0.


The contents of `perlfunc` relating to `split` uses single quotes
and slashes indiscriminately to delimit the first PATTERN parameter.

I suggest that this is contrary to currently-favoured best practice,
and the delimiters should be slashes throughout, except for the
special case of a single space

There are solid reasons why this is the preferred form​:

- The PATTERN behaves as a regular expression, so '.' will match any
character (and produce an empty list). That is made much clearer by
using /./ instead

- A single literal space ' ' is different from a regular expression
/ / containing the same string. It therefore seems best to use t
​​
he
form that corresponds to the actual behaviour for any other value

- The PATTERN is processed again as a regular expression, so one may
expect a split on the two-character string '\t' to be different from
using the one-character string "\t". In practice the two are
identical because of the secondary processing



Flags​:
  category=docs
  severity=low


Site configuration information for perl 5.22.0​:

Configured by strawberry-perl at Mon Jun 1 20​:06​:45 2015.

Summary of my perl5 (revision 5 version 22 subversion 0) configuration​:

  Platform​:
  osname=MSWin32, osvers=6.3, archname=MSWin32-x86-multi-thread-64int
  uname='Win32 strawberry-perl 5.22.0.1 #1 Mon Jun 1 20​:04​:50 2015 i386'
  config_args='undef'
  hint=recommended, useposix=true, d_sigaction=undef
  useithreads=define, usemultiplicity=define
  use64bitint=define, use64bitall=undef, uselongdouble=undef
  usemymalloc=n, bincompat5005=undef
  Compiler​:
  cc='gcc', ccflags =' -s -O2 -DWIN32 -DPERL_TEXTMODE_SCRIPTS
-DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -fwrapv -fno-strict-aliasing
-mms-bitfields',
  optimize='-s -O2',
  cppflags='-DWIN32'
  ccversion='', gccversion='4.9.2', gccosandvers=''
  intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=12345678,
doublekind=3
  d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8,
longdblkind=3
  ivtype='long long', ivsize=8, nvtype='double', nvsize=8, Off_t='long
long', lseeksize=8
  alignbytes=8, prototype=define
  Linker and Libraries​:
  ld='g++', ldflags ='-s -L"C​:\STRAWB1\perl\lib\CORE"
-L"C​:\STRAWB
1\c\lib"'
  libpth=C​:\STRAWB1\c\lib C​:\STRAWB1\c\i686-w64-mingw32\lib
C​:\STRAWB1\c\lib\gcc\i686-w64-mingw32\4.9.2
  libs=-lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32
-ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr
-lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32
  perllibs=-lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32
-ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr
-lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32
  libc=, so=dll, useshrplib=true, libperl=libperl522.a
  gnulibc_version=''
  Dynamic Linking​:
  dlsrc=dl_win32.xs, dlext=xs.dll, d_dlsymun=undef, ccdlflags=' '
  cccdlflags=' ', lddlflags='-mdll -s -L"C​:\STRAWB
1\perl\lib\CORE"
-L"C​:\STRAWB~1\c\lib"'


@​INC for perl 5.22.0​:
  C​:/Strawberry/perl/site/lib/MSWin32-x86-multi-thread-64int
  C​:/Strawberry/perl/site/lib
  C​:/Strawberry/perl/vendor/lib
  C​:/Strawberry/perl/lib
  .


Environment for perl 5.22.0​:
  HOME (unset)
  LANG (unset)
  LANGUAGE (unset)
  LD_LIBRARY_PATH (unset)
  LOGDIR (unset)
  PATH=C​:\Python27\;C​:\Python27\Scripts;C​:\Program Files (x86)\Common
Files\Intel\Shared
Files\cpp\bin\Intel64;C​:\Windows\system32;C​:\Windows;C​:\Windows\System32\Wbem;C​:\Windows\System32\WindowsPowerShell\v1.0\;C​:\Strawberry\c\bin;C​:\Strawberry\perl\site\bin;C​:\Strawberry\perl\bin;C​:\ffmpeg\bin;C​:\Program
Files (x86)\Git\cmd;C​:\Program Files (x86)\NVIDIA
Corporation\PhysX\Common;C​:\WINDOWS\system32;C​:\WINDOWS;C​:\WINDOWS\System32\Wbem;C​:\WINDOWS\System32\WindowsPowerShell\v1.0\
  PERL_BADLANG (unset)
  SHELL (unset)

@p5pRT
Copy link
Author

p5pRT commented Jul 13, 2015

From @jkeenan

On Mon Jul 13 05​:09​:40 2015, the.rob.dixon@​gmail.com wrote​:

This is a bug report for perl from the.rob.dixon@​gmail.com,
generated with the help of perlbug 1.40 running under perl 5.22.0.

-----------------------------------------------------------------

The contents of `perlfunc` relating to `split` uses single quotes
and slashes indiscriminately to delimit the first PATTERN parameter.

I suggest that this is contrary to currently-favoured best practice,
and the delimiters should be slashes throughout, except for the
special case of a single space

There are solid reasons why this is the preferred form​:

- The PATTERN behaves as a regular expression, so '.' will match any
character (and produce an empty list). That is made much clearer by
using /./ instead

- A single literal space ' ' is different from a regular expression
/ / containing the same string. It therefore seems best to use t
he
form that corresponds to the actual behaviour for any other value

- The PATTERN is processed again as a regular expression, so one may
expect a split on the two-character string '\t' to be different from
using the one-character string "\t". In practice the two are
identical because of the secondary processing

Would you be willing and able to supply a patch which implements your recommendation? If so, please attach it to this RT or to an email response.

Thank you very much.

-----------------------------------------------------------------
---
Flags​:
category=docs
severity=low
---
Site configuration information for perl 5.22.0​:

Configured by strawberry-perl at Mon Jun 1 20​:06​:45 2015.

Summary of my perl5 (revision 5 version 22 subversion 0)
configuration​:

Platform​:
osname=MSWin32, osvers=6.3, archname=MSWin32-x86-multi-thread-64int
uname='Win32 strawberry-perl 5.22.0.1 #1 Mon Jun 1 20​:04​:50 2015
i386'
config_args='undef'
hint=recommended, useposix=true, d_sigaction=undef
useithreads=define, usemultiplicity=define
use64bitint=define, use64bitall=undef, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler​:
cc='gcc', ccflags =' -s -O2 -DWIN32 -DPERL_TEXTMODE_SCRIPTS
-DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -fwrapv -fno-strict-
aliasing
-mms-bitfields',
optimize='-s -O2',
cppflags='-DWIN32'
ccversion='', gccversion='4.9.2', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=12345678,
doublekind=3
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8,
longdblkind=3
ivtype='long long', ivsize=8, nvtype='double', nvsize=8, Off_t='long
long', lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries​:
ld='g++', ldflags ='-s -L"C​:\STRAWB1\perl\lib\CORE"
-L"C​:\STRAWB
1\c\lib"'
libpth=C​:\STRAWB1\c\lib C​:\STRAWB1\c\i686-w64-mingw32\lib
C​:\STRAWB1\c\lib\gcc\i686-w64-mingw32\4.9.2
libs=-lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32
-ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32
-lmpr
-lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32
perllibs=-lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool
-lcomdlg32
-ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32
-lmpr
-lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32
libc=, so=dll, useshrplib=true, libperl=libperl522.a
gnulibc_version=''
Dynamic Linking​:
dlsrc=dl_win32.xs, dlext=xs.dll, d_dlsymun=undef, ccdlflags=' '
cccdlflags=' ', lddlflags='-mdll -s -L"C​:\STRAWB
1\perl\lib\CORE"
-L"C​:\STRAWB~1\c\lib"'

---
@​INC for perl 5.22.0​:
C​:/Strawberry/perl/site/lib/MSWin32-x86-multi-thread-64int
C​:/Strawberry/perl/site/lib
C​:/Strawberry/perl/vendor/lib
C​:/Strawberry/perl/lib
.

---
Environment for perl 5.22.0​:
HOME (unset)
LANG (unset)
LANGUAGE (unset)
LD_LIBRARY_PATH (unset)
LOGDIR (unset)
PATH=C​:\Python27\;C​:\Python27\Scripts;C​:\Program Files
(x86)\Common
Files\Intel\Shared
Files\cpp\bin\Intel64;C​:\Windows\system32;C​:\Windows;C​:\Windows\System32\Wbem;C​:\Windows\System32\WindowsPowerShell\v1.0\;C​:\Strawberry\c\bin;C​:\Strawberry\perl\site\bin;C​:\Strawberry\perl\bin;C​:\ffmpeg\bin;C​:\Program
Files (x86)\Git\cmd;C​:\Program Files (x86)\NVIDIA
Corporation\PhysX\Common;C​:\WINDOWS\system32;C​:\WINDOWS;C​:\WINDOWS\System32\Wbem;C​:\WINDOWS\System32\WindowsPowerShell\v1.0\
PERL_BADLANG (unset)
SHELL (unset)

--
James E Keenan (jkeenan@​cpan.org)

@p5pRT
Copy link
Author

p5pRT commented Jul 13, 2015

The RT System itself - Status changed from 'new' to 'open'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants