perl5 icon indicating copy to clipboard operation
perl5 copied to clipboard

[EXPERIMENT] more paired delimiters for quote-like operators

Open rjbs opened this issue 2 years ago • 6 comments

Perl 5.36.0 introduced the extra_paired_delimiters feature, which allows many non-ASCII mirrored bracketing pairs to be used for quote-like operators. For example:

my @words = qw« tinker tailor soldier spy »;

This is likely to change as Unicode evolves. In fact, Unicode appears to be in the process of identifying just the character set we'd like to use!

rjbs avatar May 21 '22 18:05 rjbs

There is a full list (as of Unicode 14) in https://perldoc.perl.org/feature#The-'extra_paired_delimiters'-feature, but the build code generates the delimiters from the Unicode database shipped with Perl. The algorithm is in regen/unicode_constants.pl, and it's really hairy because it doesn't just take Bidi_Mirroring_Glyph into account, but does name-based shenanigans (like looking for a RIGHT FOO if the character is called a LEFT FOO, or flipping EAST and WEST, or looking for a REVERSED FOO if the character is called FOO) with lots of special cases..

mauke avatar Apr 11 '24 19:04 mauke

I apologize for the noise: I thought that I had deleted my comment before anyone would notice. So you're answering my now-extinct question (about what makes "many non-ASCII mirrored bracketing pairs") - for which I had in the meantime found another answer in perldoc feature. I'll use the rather human-readable (and also Perl-parseable) list in feature.pm to set up the syntax highlighting in Emacs CPerl mode.

HaraldJoerg avatar Apr 11 '24 19:04 HaraldJoerg

Note that list may at some point move from there to a more permanent documentation like perlop.

Grinnz avatar Apr 11 '24 20:04 Grinnz

This is also the code used to generate the constants for the C code: https://github.com/Perl/perl5/blob/v5.39.9/regen/unicode_constants.pl#L391 which becomes https://github.com/Perl/perl5/blob/v5.39.9/unicode_constants.h#L100.

zmughal avatar Apr 11 '24 20:04 zmughal

Calling for the GitHub maintainer to close this issue after @leonerd's https://github.com/Perl/perl5/commit/4b6ad5110c29c13149771584eabe8b42feb5c63c commit making the feature stable.

rwp0 avatar Apr 11 '24 21:04 rwp0

This feature has been moved back to experimental due to #22228/#22229

haarg avatar May 29 '24 00:05 haarg