So unicode quotes and ASCII quotes are not exactly the same in this scenario.
The second is that there's a significant difference between "won't run due to syntax errors" and spitting a pasted line back at you since it thinks it's just a string. In a less robust environment the first option might actually crash your environment, or leave you with subtle errors. Like in a shell, it might treat things like escape sequences and things will look off unless you reset them.
Personally, I don't see any reason to hate typographically correct quote marks when used correctly, which (obviously) doesn't include code samples.
Seems such an obvious interface to innovate, but it seems to run into terminal wizards sense of purity.
The vast majority of programming languages are defined in terms of ASCII and only ASCII. I don't care for this, personally.
I've given some thought to how to do quoting right in a programming language, and implemented «guillemets» as an experiment. But it's challenging, you need to decide what to do with all of “”‟„"″ and there aren't obvious pairings, like „this is a sentence” and “this is a sentence” and »this is a sentence» and «this is a sentence» and »this is a sentence«, it ends up feeling like rather a lot of effort for what you get in return.
Oh, one of those characters I typed isn't a quotation mark, did you catch which one? Hacker news won't even let me type two of them!
The tradeoff is not worth it for programming languages the same way as learning all the scripts of the world is not worth it for one human being, just to accomplish tasks that don't need all these symbols in the first place.
Already fully designed and implemented in Raku: https://docs.raku.org/language/unicode_entry#Smart_quotes
Test online: https://tio.run/##K0gtyjH7//9Rw7ySjMxiBSBKVChOzStJzUtOfdQw9/...
Sure: these are all quibbles, and a language wouldn't die from all these minor cuts. But they're definitely downsides, not upsides. So: where is that upside? Why would you ever support something like this? "It looks a little nicer" sounds like a pretty weak argument compared to "it's inconsistent, hard to machine process, and may cause a few bugs"...
I want «guillemet strings» because they use a matched pair, so you can «quote a string «within a string» without escaping» and I think that's a nice property.
I'm not really interested in supporting all the forms in which they're used in European languages, though, that would be a real hassle. Just the one that looks like the other matched pairs we use in programming.
“smart quotes” have ‟at least two styles” and really „three styles”, and the first two are really easy to confuse with "normal double-quotes". I don't want my users to have to deal with "why doesn't this compile”?, and if I allowed it to compile, now you have to escape all the quote characters inside any string, which is messy.
Raku, as a sibling points out, has bitten down on this bullet, and I respect that. I keep meaning to give it a spin, I'm fond of Parsing Expression Grammars and have good feelings about Perl from the early days.
.say for q[‟”].uninames
# DOUBLE HIGH-REVERSED-9 QUOTATION MARK
# RIGHT DOUBLE QUOTATION MARK
If you use one type of quote, you can use the others inside of it with no problem. “double "quotes"”
(Raku doesn't use a tokenizer.)Also note that you can use a variety of characters for quoting if you use `q`, `qq` or `Q` etc.
q<<<<1 < 2>>>> eq '1 < 2' eq q^1 < 2^ eq q%1 < 2% eq q「1 < 2」
Note that many Unicode characters which have a LEFT and RIGHT variant will also be paired when you do that. q⦑like this⦒In Raku string literals are actually a [parameterized domain specific language](https://docs.raku.org/language/quoting). (The domain of creating strings.)
my $buffer = Blob.new(115,116,114,105,110,103); # 'string'.encode()
Q # start with raw quoting
:scalar # enable embedding the value of scalars
:backslash # enable backslashing characters
[This is a $buffer.decode()\n]
There are shortcuts for common uses 'single' eq q [single] eq Q :single [single] eq Q :q [single]
‘single’ eq ‚single’
"double" eq qq [double] eq Q :double [double] eq Q :qq [double]
“double” eq „double”
「raw」 eq Q [raw]
< words > eqv qw [ words ] eqv q :words [ words ]
<< quote words >> eqv qqww [ quote words ] eqv Q :double :quotewords [ quote words ]
« quote words »
This is not exhaustive.:double is actually short for :scalar :array :hash :function :closure :backslash
:words splits on whitespace :quotewords splits on whitespace but respects quoted sections
q :words [ a "b c" ] eqv ( 'a', '"b', 'c"' )
q :quotewords [ a "b c" ] eqv ( 'a', 'b c' )
Note that :double is the same as any adverb in the language, so you can negate a feature with :!double. qq [with newline\n]
qq :!backslash [without newline\n]
qq :!array [user@example.com()]
(It's actually rather difficult to accidently use @ or % variables.)After all, users of non-ascii languages (which is nearly everyone) already know how to deal with it without ambiguity. Its only ambiguous if you don't use encodings, and that should never happen anyway.
If you are going to get rid of it anyways, why bother with it in the first place? Also, you then have the ambiguity/problem whether some symbols are mapped to the same ones or not.
> already know how to deal with it without ambiguity
I wish. Just dealing with ü vs ue vs \"u and ascii, win something, utf8 and utf16 is still annoying in practice. Or latex choking on accents, non-breaking whitespace or similar fun stuff.
Oh, you used foo and föö as variable names, too bad those are the same now by normalization.
> It's really solved, but you would never know if you live exclusively on the command line. Which I think is unfortunate.
Tone down the condescension and insults, please.
Also, they're difficult to type - my keyboard has a " key but not a “ or ” character. I had to copy and paste those from the unicode website since I don't have a suitable input method set up.
Or [Shift]+[Option] [B04] and [Shift]+[Option] [B05] if there's no explicit [Group2] shift.
Open and close single quotation marks use the same keys.
"terminal wizards" have done quite the opposite of rejecting this.