robert-strandh / SICL

A fresh implementation of Common Lisp
Other
1.07k stars 79 forks source link

Define condition method-already-on-generic-function #85

Open robert-strandh opened 7 years ago

robert-strandh commented 7 years ago

In the file Code/CLOS/add-remove-method-support.lisp, in the function add-method-default, a simple error is signaled when an attempt is made to add a method to a generic function, but that method is already associated with the generic function.

To avoid the simple error, in the file Code/CLOS/conditions.lisp, define a new condition named METHOD-ALREADY-ON-GENERIC-FUNCTION, modeled after the other conditions in that file. Do not use the :REPORT option. Define two slots %METHOD and %GENERIC-FUNCTION with readers METHOD and GENERIC-FUNCTION respectively.

In the file Code/CLOS/condition-reporters-english.lisp, define a method for reporting the new condition, modeled after the other methods in this file.

In the file Code/CLOS/packages.lisp, shadow the symbols METHOD and GENERIC-FUNCTION.