On 12/6/19 6:52 PM, Wes Hurd wrote:
What I meant about smart quotes being dangerous was, if copying the
output text that contains smart quotes to use somewhere else (especially
in code), the smart quotes have to be manually replaced which is tedious
for the user (programmer).
The user may not even see that smart quotes are being used unless there
is a breaking error.
That sort of problem can occur with any quoting style. For example:
$ cp '\0' 'xxx'
cp: cannot stat '\0': No such file or directory
If I cut the '\0' (including the apostrophes) and then paste it into a C
program, like this:
char *filename = '\0';
the program will compile (it's valid C code!), but it won't do what I
want. If I paste '\0' into a Python program, I'll get a different string
(it's a valid Python string too) but it won't equal the filename I gave
to 'cp'.
Arguably curved quotes would be *safer* than apostrophes here, because
they would require the programmer to think about quoting when the
programmer is doing something silly like copying quoted strings blindly
into a program.
Admittedly this example is contrived, but there's lots of non-contrived
examples like it.