unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Noam Postavsky <npostavs@users.sourceforge.net>
Cc: Alan Mackenzie <acm@muc.de>, 30217@debbugs.gnu.org
Subject: bug#30217: Ambiguity in NEWS in emacs-26.0.91
Date: Tue, 23 Jan 2018 07:53:49 -0800 (PST)	[thread overview]
Message-ID: <1a1fbaea-f291-414d-aaef-bf41ea4a5873@default> (raw)
In-Reply-To: <871sigohv9.fsf@users.sourceforge.net>

> The OP of Bug#2967 says
>     I think it would be good if emacs looked for smart
>     quotes in .emacs files and gave a warning or notice
>     if it detected them. This would help troubleshooting.
>     Which is exactly what's being done now.

It's not necessarily appropriate to satisfy every
suggestion offered in every bug report. ;-)

I'm not sure such a warning is good, rather than bad.
I think not.  If a warning was printed for each "smart
quote" occurrence in a file that would surely be bad,
IMO.

An Emacs-Lisp file can contain pretty much anything,
including lots of natural-language text.  Are we now
issuing warnings even for "smart quotes" in comments
and strings?  That would definitely be a mistake.

In any case, I don't care much about byte-compiler
warnings - they are not the problem I responded to.
They can be ignored when they are not particularly
relevant.  The fact that they can sometimes represent
noise is at most an annoyance, not a real problem.

> The OP of Bug#23425 says
>   When this output is fed back into Emacs with M-:,

That represents pilot error, no doubt.

For `M-:' we _might_ try to provide an error message
that says you included a "smart quote" and say you
might want to check that that's what you intended.

I'm not suggesting we do that - I prefer not.  But
it's conceivable, if someone is really gung ho about
solving the purported problem.

I doubt that would be a good idea even for `M-:'.
But it would surely not be appropriate for other
contexts.

And even for `M-:' it's not obvious that we would
come up with a good test for the cases where it
would be helpful rather than confusing.

>   it produces an obscure error message.
> 
> The Emacs 25 error for the expression in question is
>   (wrong-number-of-arguments setq 31)

Which tells you pretty much that setq is missing an
argument or has too many, which makes you look at its
arguments.  Not so obscure.  And accurate.

> In Emacs 26.0.91, it is
>   (invalid-read-syntax "strange quote" "’")

Which is completely obscure, IMO.  Invalid read
syntax when reading what?  What's invalid about it?

In fact, it is not invalid.  It has never been invalid,
and it shouldn't suddenly be considered invalid now.

Confusion, not understanding an accurate error msg,
is not the same thing as Lisp itself having a bug
because such a character is included in a symbol.

> I think this is an improvement, since it does, in fact,
> indicate there is a problematic use of ’.

There is NOT any problematic use of ’ there.  The
user's understanding might be problematic, but that
read syntax is not problematic for Lisp.

Help users if we can, but don't screw Lisp in the
process.

(setq ’bar 42)
(setq foo ’bar)

That's perfectly fine Lisp, even if it might not be
what some might expect.  But now, after your "fix",
the first sexp raises an error - at read time, no less.

This is just wrong, IMO.  You've redefined Lisp
evaluation, taking away some of the importance of
symbols.  And this still raises no error:
(setq a’bar 42).

> Why do you think the signalling an error in this case
> is a bad idea?

Because it is.  Ms Lisp all her users are being
treated unfairly.  See above, and see my previous msg.

’bar is a fine symbol.  ’ has NO special meaning in
Lisp - it is NOT like ' or ` or ( or ) or . or , or @.

Now you've given it a special meaning: when in a
context where ' is special, raise an error because
it is not '.

That's plain wrong and confusing, and it subtracts
from Lisp (while adding nonsense to it).

> > If no one has a real fix for such bugs yet then please just
> > leave them open until someone comes up with a good idea.
> > This "fix" is not a good idea - for those bugs at least.
> >
> > If this fix has some other purpose, then let's please
> > know what that is and talk about it.
> >
> > But if such problems are the only reason for this "fix"
> > then please consider getting rid of such silly and useless
> > escaping and just change the error message
> 
> I don't quite understand what you mean by "getting rid of... escaping"
> but keeping the error message.  It sounds like a you are contradicting
> yourself.

I didn't say keep the error msg.  I said that if you
really think that some warning or error msg is important
here then fine.  But then improve the msg.

But I do NOT think that an error msg or warning is good
here.  A warning maybe, but not an error, which prevents
evaluation.  (But I doubt that warnings can be used here
accurately and without sowing ever more confusion.) 

Aside from the error/warning, such _escaping_ is another
bad idea.  It too subtracts from Lisp (while adding
nonsense to it).

IMHO, this "fix" - all of its parts - should be reverted
ASAP.  If you want to add some better error messaging
where we already raise an error, and if we can really
distinguish the cases where the better messaging should
be used, fine.  And if you want to add some warnings,
and if we can really distinguish the cases where the
warnings would be appropriate - accurately, fine.

To be clear, though, I'm in favor of neither of those
things.  Just leave it alone.  Using (mistakenly or
purposefully) such characters in symbol names is just
another potential gotcha.

There are plenty of them.  Users need to learn, e.g.,
that . is a symbol-constituent char in Lisp - so you
can have a symbol `a.b'.  And (a.b) is not the same
as (a . b).  Will you start requiring users to escape
the . in the symbol `a.b'?

To be really clear, the fix proposed should be removed.
Such characters, even if perhaps sometimes confusing
to some users, are legitimate symbol characters.  They
should just be left alone.  At _most_, and only if the
analysis were super-accurate and crystal clear, we
could consider adding warnings here or there.  We must
certainly not change Lisp here - no error-raising.

Starting to special-case such characters will get us
in a world of trouble - mark my words.

And as I said, there's no limit to the supply of such
chars.

> Changing the error message is always possible, of course.  I'm not sure
> if bringing "ascii" into it would make things clearer though.  Concrete
> suggestions welcome.

See above.  Please drop this attempted "fix" altogether.
It's just misguided, IMO.

At most, if you are persuaded that something needs to be
done about such "bugs" (warning pilots about such possible
pilot error) then please bring it up in emacs-devel.  You
are modifying Lisp itself in a basic way.  This should be
a no-no.

> > And besides - where do you stop doing this kind of thing?
> >
> > Do we do something similar for characters that can
> > be mistaken for a period, in case you use one in an
> > attempt at dotted-pair syntax?
> >
> > Do we do something similar for chars that can be
> > mistaken for a comma, inside backquoted sexps?
> >
> > Do we do something similar for chars that can be
> > mistaken for a backquote?  An at-sign?  Ordinary
> > parentheses?
> 
> Maybe everything in the "Unicode confusables" listing?  Practically
> speaking, I've never heard of problems with other characters, except
> perhaps in programming "puzzles", obfuscated code contents and the like.

There are lots of chars that can be confused, especially
given the possibility of different fonts.  I didn't even
mention other variants of brackets (aka square brackets),
braces (aka curly brackets), angle brackets, etc.

Would you try to protect a user from the confusion of
copy+pasting FULLWIDTH LEFT CURLY BRACKET FF5B{ in place
of LEFT CURLY BRACKET 7B { in a doc string ("... \\{...}")
or in a regexp?  Or of using LEFT WHITE SQUARE BRACKET
301A 〚 in place of [ in a vector?

Lisp is simple - and its use can be complicated.  You are
complicating Lisp itself immensely here.  Will you provide
fancy analysis for all of the possible contexts where such
char confusion could arise?

This is a big mistake - a crack in the foundation, IMO,
even if you think of it now only as helping a user with
a copy+paste error (pilot error).

> > I really hope you reconsider this.  To me it looks
> > like an ugly hack that can bring only harm (including
> > more, not less, confusion), not good.
> 
> Do you have any specific harms/confusion in mind?

See above.

This is *harmful* for our nice, clean Lisp - and YAGNI.





  reply	other threads:[~2018-01-23 15:53 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-22 22:17 bug#30217: Ambiguity in NEWS in emacs-26.0.91 Alan Mackenzie
2018-01-22 22:42 ` Drew Adams
2018-01-23  0:42   ` Noam Postavsky
2018-01-23  0:56     ` Drew Adams
2018-01-23  1:40       ` Noam Postavsky
2018-01-23  6:07         ` Drew Adams
2018-01-23  6:21           ` Drew Adams
2018-01-23 12:54           ` Noam Postavsky
2018-01-23 15:53             ` Drew Adams [this message]
2018-01-23 23:00               ` Noam Postavsky
2018-01-23 23:19                 ` Drew Adams
2018-01-24  0:02                   ` Noam Postavsky
2018-01-28 15:52                     ` Noam Postavsky
2018-02-02 18:52                       ` Drew Adams
2018-02-02 19:08                         ` Noam Postavsky
2018-02-02 21:37                           ` Drew Adams
2018-02-02 22:14                             ` Ista Zahn
2018-02-02 22:35                               ` Noam Postavsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1a1fbaea-f291-414d-aaef-bf41ea4a5873@default \
    --to=drew.adams@oracle.com \
    --cc=30217@debbugs.gnu.org \
    --cc=acm@muc.de \
    --cc=npostavs@users.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).