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

Q doesn't like fancy quotes #5913

Closed
p6rt opened this issue Dec 25, 2016 · 4 comments
Closed

Q doesn't like fancy quotes #5913

p6rt opened this issue Dec 25, 2016 · 4 comments

Comments

@p6rt
Copy link

p6rt commented Dec 25, 2016

Migrated from rt.perl.org#130406 (status was 'rejected')

Searchable as RT130406$

@p6rt
Copy link
Author

p6rt commented Dec 25, 2016

From @gfldex

Q„1“;
# OUTPUT«===SORRY!=== Error while compiling <tmp>␤Couldn't find terminator ” (corresponding „ was at line 1)␤at <tmp>​:1␤------> Q„1“;⏏<EOL>␤ expecting any of​:␤ ”␤»

@p6rt
Copy link
Author

p6rt commented Dec 26, 2016

From @zoffixznet

On Sun, 25 Dec 2016 12​:16​:39 -0800, gfldex wrote​:

Q„1“;
# OUTPUT«===SORRY!=== Error while compiling <tmp>␤Couldn't find
terminator ” (corresponding „ was at line 1)␤at <tmp>​:1␤------>
Q„1“;⏏<EOL>␤ expecting any of​:␤ ”␤»

Thank you for the report. Unfortunatelly, I'm going to close it as wontfix.

Fancy quotes work. You're just attempting to use the *LEFT* DOUBLE QUOTATION MARK with 'Punctuation Initial' property
on the right side, to signal the end of the quote.

If you use the RIGHT quote, it'll work just fine​:

  <Zoffix> m​: dd Q„42”
  <camelia> rakudo-moar 1ee24c​: OUTPUT«"42"␤»

I realize our bare strings are special-cased to handle 4 unusual combinations of quoters (which IMO is a somewhat warty feature).
However, I'm not seeing any worthy benefit in extending special-casing to all of our quoters (this would include regexes, shell-out quoters, and WHY comments too).
Currently, the algorithm assumes each delimiter has exactly one paired character for it, with all the performance benefits that stem from that.

It's worth noting that quoters allow repeated delimiters, while bare strings don't​:

  <Zoffix> m​: dd „„„42”””
  <camelia> rakudo-moar 1ee24c​: OUTPUT«"„„42””"␤»
  <Zoffix> m​: dd Q„„„42”””
  <camelia> rakudo-moar 1ee24c​: OUTPUT«"42"␤»

Special-casing the 4 quote combinations we special-case in bare strings would mean mixed delimiter quotes are also valid and this code would parse as string "foo"​: „“„foo”“”

So we'd introduce weird possibilities and suffer (possibly noticeable) performance loss in regex, Q, qq, qw, qx quoters and WHY comments... If consistency is an issue, I'd rather see weird pairings removed from bare strings.

Considering there are about 1,000,000 characters you can use as delimiters and by repeating them can have an infinite number of possible quoter delimiters, adding several special cases throughout the codebase seems unjustified.

Cheers,
ZZ

@p6rt
Copy link
Author

p6rt commented Dec 26, 2016

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

@p6rt
Copy link
Author

p6rt commented Dec 26, 2016

@zoffixznet - Status changed from 'open' to 'rejected'

@p6rt p6rt closed this as completed Dec 26, 2016
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

1 participant