emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Why "symbol's value" error about a list?


From: Drew Adams
Subject: RE: Why "symbol's value" error about a list?
Date: Tue, 6 Feb 2018 07:45:55 -0800 (PST)

> > > The error message given out is:
> > >     Symbol's value as variable is void: ’bar
> >
> > That was the old, and legitimate, error message, yes.  It
> > accurately describes what is really going on (as you describe
> > well, below).
> >
> > Now the message is instead (invalid-read-syntax "strange quote"
> > "’").  Is that better?
> 
> I think it's somewhat better, because it talks about "strange quote",
> which is a hint for the user about the actual problem.

The actual problem is the use of a non-variable symbol
as a variable.  At least that has been the problem in
this example, until the recent change in Lisp syntax.

There's no problem using a symbol as a variable if its
name is ’bar.  You've just made it necessary now to
escape that curly quote when defining and using the
symbol:

 (defvar \’bar 42 "...")

And if a variable in fact has that name you still raise
a Lisp read-syntax error if the quote is not escaped.

> > I suggested that the variable name be enclosed in `...'.  That
> > would make the original message clearer, I think:
> >   Symbol's value as variable is void: `’bar'
> 
> That might make things even more confusing, because the text actually
> displayed will be this:
>     Symbol’s value as variable is void: ‘’bar’
> which loses all hints of what is being quoted here.

I wrote `’bar'.

> > > This is a result of the change in `message', silently to
> > > convert ' to a curly quote, by default.  Some of us were
> > > unhappy at this change and protested against it.
> >
> > Count me as one of those "some of us".  Echoing Lisp code
> > should do just that - no fiddling to "prettify" apostrophe to
> > curly quote etc.
> 
> That ship has sailed two Emacs releases ago.  We are trying to
> fix the fallout.

Two releases ago and still reaping the fallout rewards...
Time to call back that ship or try to redirect it?

> And strange quotes is only one situation where confusingly similar
> characters can be presented in error messages, making it hard for
> users to spot the real problem.  We are trying to find ways of making
> such "typos" more evident in error messages.

Where's the error in  (defvar ’bar 42 "...")?
You've introduced Lisp read errors where there were
none.

The error here is the automatic translation of a Lisp
sexp that uses an ordinary quote mark (apostrophe) to
a curly quote by `message' (?), so that the wrong sexp
gets logged to *Messages*.

The second error is trying to fix that error by changing
Lisp syntax so that an error is raised, instead of just
(optionally) displaying a warning message.  There's no
reason to stop Lisp evaluation just because we want to
inform a user about a possible misunderstanding (gotcha).

> > The error is using a symbol as a variable, when it is not
> > defined as a variable.  Which is exactly what the original
> > error message said.
> >
> > That's the LISP error.  Is there a _user error_ here?
> > Yes, it's the mistake of copying and pasting what was
> > printed in *Messages*.
> >
> > That user mistake is excusable.  And we would want to
> > inform the user about it, if we can't prevent it.  But
> > changing Lisp read syntax to guess what might be the
> > most helpful thing to tell a user here is NOT the solution.
> 
> The issue is what _would_ be a helpful message in these cases.  You
> are just saying what should _not_ be done (repeatedly), but that
> doesn't advance us towards the solution.

I've said (repeatedly, as you like to repeat) that we can
display all the warnings you like.  What we should not do
is change Lisp syntax to raise an artificial error.

There is no Lisp error in evaluating (setq ’bar 42),
regardless of how or why someone might do that.  It's
fine to let someone know that s?he did it, pointing
to the curly quote.  It's wrong to raise a Lisp error.

> > Should this Lisp syntax change be reverted?  That's the
> > question being discussed here.
> 
> No, that's only part of the question.  The other, no less important
> part is if we revert that change, how to make the confusing error
> message less so and more helpful in understanding the user error.

Agreed.  The first step is to revert the change in Lisp
syntax.  The second step is to design aids for users to
recognize such gotchas.

The zeroth step is to realize that the Lisp change should
be reverted.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]