[Top][All Lists]

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

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

From: Eli Zaretskii
Subject: Re: Why "symbol's value" error about a list?
Date: Tue, 06 Feb 2018 21:17:08 +0200

> Date: Tue, 6 Feb 2018 07:45:55 -0800 (PST)
> From: Drew Adams <address@hidden>
> Cc: address@hidden, address@hidden, address@hidden,
>         address@hidden
> > > > 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.

That's one possibility, yes.  But a much more probable possibility is
that the user mistyped the quote, either because she copy/pasted it
from some text, or because she turned on the Electric Quote mode, or
for some other reason.

A useful error message should consider this latter probable cause and
help the user correct it, if indeed that was the reason.  Many tools
do similar second-guessing for frequent mistakes.  For example. GNU
Make detects when a line in a Makefile starts with 8 SPC characters
instead of a mandatory TAB, and says:

 *** missing separator (did you mean TAB instead of 8 spaces?).

The first part is the "dumb" error message, based on the syntax error,
the part in parentheses is a helpful hint for the user, based on many
such user errors seen in the past.

Latest versions of GCC also provide similar hints.

> You've just made it necessary now to escape that curly quote when
> defining and using the symbol:

You are changing the subject.  I just wrote that an error message
which mentions "strange quotes" is somewhat better than one which just
states the syntax error.  I said nothing about anything else.

> > >   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'.

Yes, but the Lisp function 'message' has its own ideas regarding
quoting text, as you well know.  Try evaluating this:

  (message "Symbol's value as variable is void: `%s'" "’bar")

> > 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?

You can try fighting this Quixotic battle on and on, but I don't
recommend that.

> You've introduced Lisp read errors where there were
> none.

No, I didn't do anything of the kind.
> > > 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.

I think both steps should be made together, otherwise we would be
making a change for the worse.

reply via email to

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