P.S. Major coincide I was googling this very question yesterday?
ASCII and Unicode quotation marks
121–130 of 195 posts
Re: ASCII and Unicode quotation marks
#122Earlier quoted context omitted.
Same, I’ve never cared for it. For these reasons I’ve decided to take a stand and avoid using the grave accent for anything in a programming language I’m working on. Same goes for the dollar sign, because it’s somewhat Americentric, and as a currency character it doesn’t have any great semantic or mnemonic value except for, well, currency units. I guess you could argue for $trings (BASIC) or $calars (Perl) if you hav…
> Same goes for the dollar sign, because it’s somewhat Americentric, and as a currency character it doesn’t have any great semantic or mnemonic value except for, well, currency units. By that metric, wouldn't & be too Anglo-centric, and # be too Euro-centric? There are layouts out there on which neither is readily available.
English is the lingua franca of programming, so it’s hard to avoid some Anglicisms (like ampersand meaning “and”, dot instead of comma for decimals, and English-language keywords) without going against strong precedents set by other languages. If I really wanted to be pedantic, I might use /\ and \/ for logical “and” and “or”—those spellings are the major reason that the backslash even exists in ASCII.
Re: ASCII and Unicode quotation marks
#123It just occurred to me how much easier certain text-operations (like syntax highlighting, regular expressions and other parsers) if we consistently used the right unicode symbols for quotes and apostrophes
The only languages I know off the top of my head that use balanced delimiters for strings are M4 and Perl 6. Hey, imagine being able to nest strings without escaping! What a concept!
Nesting string literals without escaping is a somewhat poor concept, though. Firstly, what does that even mean? Given `abc `def' ghi', what is the string here? Is it abc def ghi or is it abc `def' ghi? Secondly, what if I want to just have an unbalanced ` character in the string data?
Re: ASCII and Unicode quotation marks
#124Earlier quoted context omitted.
If ASCII had balanced quotes then they would be used by programming languages to delimit strings and we would be back to square one with regards to escaping them!
You don’t need escaping in «This is a string containing an «embedded» quoted string».
«Oh, you just use the « character.»
Parse error. Unexpected EOF.
Re: ASCII and Unicode quotation marks
#125Re: ASCII and Unicode quotation marks
#126Often it's the quotes which have been silently (automatically) converted to a visually similar (but functionally incompatible) character variant.
Re: ASCII and Unicode quotation marks
#127Earlier quoted context omitted.
The Unicode way makes sorting easier. Your way would require special knowledge about the characters to know that ä should sort directly after a, rather than directly before ë.
In fact this requires special language-specific knowledge anyway (which unicode provides in some tables and algorithms actually). In some languages ä should sort exactly as if it were 'a'. "aa", "äb", "ac". In others it should sort as a distinct letter (but not necessarily between 'a' and 'b'). Different Latin languages sort differently, I'm not sure if exact UTF-8 (or UTF 16 or UTF 32) byte ordering is actually appr…
aa ah az ba bh bz ca cz ch
treating "ch" as a single letter that comes between c and d.
or
ab ah az b c .... z aa
treating aa the same as a separate letter at the end of the alphabet.
Then there's other rules for sorting that aren't directly alphabetic, like that names beginning with "Mc" should be treated as "Mac" or "St " as "Saint ".
"10 cats" should sort after "2 cats", not before it.
Anyone who tries to sort by just numeric ordering is doing it wrong.
Re: ASCII and Unicode quotation marks
#128Earlier quoted context omitted.
I think it would make the parsing a tiny bit more inconvenient though
Yup, suddenly your parser needs to keep a count of how many nested strings deep it is.
Even for things where the nesting does happen during lexical analysis, it's pretty trivial to keep a count in your lexer. Lots of languages support nesting comment syntax or string interpolation, which both have equivalent difficulty.
Re: ASCII and Unicode quotation marks
#129Re: ASCII and Unicode quotation marks
#130Earlier quoted context omitted.
From what I recall from my childhood, physical typewriters worked slightly differently: the accent keys were non-advancing ("dead") keys. You pressed the "acute" key followed by the "e" key for an é, for instance. If you wanted a bare accent, you pressed the accent key followed by the space bar. (The typewriters I recall also didn't have a 0 or 1 key, you used uppercase O or I for these numbers.)
I believe that depended on the manufacturer and country convention. Most US keyboards didn't have an accent character. For example, here's one from the 1950s: http://www.typewriters101.com/uploads/1/7/6/6/17660651/s7662... For acute or umlaut you could use a + backspace + ' or u + backspace + " (or the opposite order). For grave or circumflex, I don't think there was a solution. Write it in by hand?