unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Poor quality error messages
@ 2022-01-05 18:37 Alan Mackenzie
  2022-01-05 19:01 ` Stefan Monnier
  0 siblings, 1 reply; 2+ messages in thread
From: Alan Mackenzie @ 2022-01-05 18:37 UTC (permalink / raw)
  To: emacs-devel

Hello, Emacs.

During a bootstrap (not of the standard code), the make failed,
presenting me with the following half error message:

  In toplevel form:
  cedet/ede.el: Error: No applicable method: initialize-instance, nil, nil
  make[2]: *** [Makefile:308: cedet/ede.elc] Error 1
  make[2]: *** Waiting for unfinished jobs....

..  Is this really the best we can do?

The following faults with this half message are readily apparent:

(i) There is no line/column numbers of the failure point in the file.  "In
  toplevel form" isn't very helpful.
(ii) There is no preposition or verb indicating the relationship between
  the missing method (whatever that is) and initialize-instance.
(iii) Is initialize-instance the method that is missing?
(iv) To what is the method (whatever that is) meant to be applicable?  To
  initialise-instance, perhaps?  Or to "nil, nil"?  Or to something else?
(v) It is not clear what the "nil, nil" at the end of the half message is
  meant to mean.

Just for info, grep finds no matches for "initialize-instance" in ede.el.

If anybody can help me on any of these points with this half error
message, please do.

I'm intending to fix (or at least ameliorate) point (i) in my current
work on the correct positions for warning messages.

At least I know what's causing the problem, in that if I remove certain
bits of code the error doesn't happen.  That's not helping me diagnose
the mechanism of this failure, though.

Thanks for any help!

-- 
Alan Mackenzie (Nuremberg, Germany).



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Poor quality error messages
  2022-01-05 18:37 Poor quality error messages Alan Mackenzie
@ 2022-01-05 19:01 ` Stefan Monnier
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2022-01-05 19:01 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: emacs-devel

Alan Mackenzie [2022-01-05 18:37:18] wrote:
> During a bootstrap (not of the standard code), the make failed,
> presenting me with the following half error message:
>
>   In toplevel form:
>   cedet/ede.el: Error: No applicable method: initialize-instance, nil, nil
>   make[2]: *** [Makefile:308: cedet/ede.elc] Error 1
>   make[2]: *** Waiting for unfinished jobs....
>
> ..  Is this really the best we can do?
>
> The following faults with this half message are readily apparent:
>
> (ii) There is no preposition or verb indicating the relationship between
>   the missing method (whatever that is) and initialize-instance.

`initialize-instance` is a "generic function" (i.e. a function defined
via `cl-defgeneric` and which can have different implementations for
different argument types, each implementation being called a "method")
and the error says that this function was called with a set of arguments
for which there is no matching method.

[ Side note: this nomenclature comes from CLOS and is a bit different
  from that used in mainstream class-based OO where what CLOS calls
  a "generic function" is often called a "method" and what CLOS calls
  a "method" is just a specific implementation of
  a method/generic-function in a particular class.  ]

> (iii) Is initialize-instance the method that is missing?

According to the error message, `initialize-instance` was called with
arguments nil and nil.  The first argument should be an object whose
slots needs to be initialized, so it shouldn't be nil, and indeed none
of the methods are applicable for the case where the first arg is nil.

> (iv) To what is the method (whatever that is) meant to be applicable?  To
>   initialise-instance, perhaps?  Or to "nil, nil"?  Or to something else?

The generic function by defaults comes with basically only one method
which handles the case where the first arg is an EIEIO object.

> (v) It is not clear what the "nil, nil" at the end of the half message is
>   meant to mean.

I think it's the list of arguments passed to `initialise-instance`.

> Just for info, grep finds no matches for "initialize-instance" in ede.el.

`initialize-instance` is used internally by `make-instance` (and
`make-instance` is used internally by the constructor defined by
`defclass`).

I.e. when the code defines a class with (defclass FOO ...) it defines
a constructor called FOO which calls `make-instance` which in turn calls
`initialize-instance` (as well as `shared-initialize`, IIRC).


        Stefan




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-01-05 19:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-05 18:37 Poor quality error messages Alan Mackenzie
2022-01-05 19:01 ` Stefan Monnier

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