Apostrophe in name removal
Do the removal described in perldeprecation
=head3 Use of C<'> as a global name separator
Perl allows use of C<'> instead of C<::> to replace the parts of a package or global variable name, for example C<A::B> and C<A'B> are equivalent.
C<'> will no longer be recognized as a name separator in Perl 5.42.
I scanned the changes and ran the tests on FreeBSD; got PASS. LGTM but the C-level changes would benefit from other eyeballs.
op.c-Perl_newATTRSUB_xLooks like it still treats'specially:|| memchr(name, ':', namlen) || memchr(name, '\'', namlen)op.c-Perl_ck_methodThis code should go:/* replace ' with :: */ while ((compatptr = (char *) memchr(SvPVX(sv), '\'', SvEND(sv) - SvPVX(sv) ))) { *compatptr = ':'; sv_insert(sv, compatptr - SvPVX_const(sv), 0, ":", 1); }mg.c-Perl_magic_setsigAnother suspicious use of':if (!memchr(s, ':', len) && !memchr(s, '\'', len))
Thanks.
op.c-Perl_newATTRSUB_xLooks like it still treats'specially:c || memchr(name, ':', namlen) || memchr(name, '\'', namlen)
op.c-Perl_ck_methodThis code should go:/* replace ' with :: */ while ((compatptr = (char *) memchr(SvPVX(sv), '\'', SvEND(sv) - SvPVX(sv) ))) { *compatptr = ':'; sv_insert(sv, compatptr - SvPVX_const(sv), 0, ":", 1); }
I couldn't see a way to test these, but removed the left over code.
* `mg.c` - `Perl_magic_setsig` Another suspicious use of `'`: ```c if (!memchr(s, ':', len) && !memchr(s, '\'', len)) ```
This one had observable behaviour which I added a test for.
I assume this PR calls for an update to perldata, under the heading Identifier parsing :
While you can mix double colons with singles quotes, the quotes must come after the colons: $::::'foo and $foo::'bar are legal, but $::'::foo and $foo'::bar are not.
There's also a big old regex in that section with rules for parsing identifiers.
pod/perlmod.pod has this:
The old package delimiter was a single quote, but double colon is now the preferred delimiter, in part because it's more readable to humans, and in part because it's more readable to emacs macros. It also makes C++ programmers feel like they know what's going on--as opposed to using the single quote as separator, which was there to make Ada programmers feel like they knew what was going on. Because the old-fashioned syntax is still supported for backwards compatibility, if you try to use a string like
"This is $owner's house", you'll be accessing$owner::s; that is, the $s variable in packageowner, which is probably not what you meant. Use braces to disambiguate, as in"This is ${owner}'s house".Using
'as a package separator is deprecated and will be removed in Perl 5.40.
@tonycoz, could you respond to the 2 preceding comments in this ticket? Thanks.
I've added updates to perldata and perlmod, I expect they will be squashed into the top commit on merge.
applied manually, thanks everyone