medley icon indicating copy to clipboard operation
medley copied to clipboard

CLOS defmethod does not mark forms to be saved by file manager

Open MattHeffron opened this issue 2 years ago • 4 comments

Describe the bug Loading a Common Lisp/CLOS file.lisp developed elsewhere (e.g., from Internet) doesn't add (defmethod name ...) forms to be noticed by (IL:FILES?) and thus they aren't included in COMS for file and are not saved.

To Reproduce Steps to reproduce the behavior:

  1. Files loaded: Load CLOS into Medley per medley\clos\README.MD instructions.
  2. load any file that contains (defmethod name ...) top-level expressions.
  3. Type (IL:FILES?) and create a new file, giving the same entry for all items indicated.
  4. The (defmethod ...) names are not in the fileCOMS.
  5. MAKEFILE the file.
  6. The (defmethod ...) forms are not in the file.

Expected behavior (defmethod name ...) forms are noticed and included in the saved file.

Screenshots If applicable, add screenshots to help explain your problem.

Context (please complete the following information):

  • OS: Win 11 WSL
  • OS Version: Ubuntu 22.04.3
  • Host arch: x86_64
  • Maiko version: 7fce08f92
  • IL:MAKESYSDATE: medley-231122-b2f750e5 -- (MAKESYSDATE) gave error "MAKESYSDATE is an undefined function"

Additional context Add any other context about the problem here.

MattHeffron avatar Dec 02 '23 01:12 MattHeffron

Loops in the loops/system/LOOPS-FILEPKG file has some of the logic for turning a MARKASCHANGED of an embedded definition into a MARKASCHANGED of the METHODS and other related things.

The equivalent is in the medley repo in medley/clos/clos-env.lisp

The latter is an interesting example of hacking the Interlisp environment in Common Lisp.

masinter avatar Dec 02 '23 03:12 masinter

Do you mean loading a file directly with LOAD? If so importing the code via the TextModules library module may be a workaround.

pamoroso avatar Dec 02 '23 11:12 pamoroso

What I was trying to do was to load the CL-YACC code (from Github). I manually converted the yacc.lisp (yacc.lisp.txt) to an Interlisp/Medley style file (CL-YACC, cl-yacc.~4~.txt). I managed to LOAD it, apparently, but the DEFMETHOD expressions either failed silently, or I hadn't included them in the converted file. (Editing code at midnight is not recommended at my age.) The DEFMETHOD expressions were all specializations of MAKE-LOAD-FORM on different STRUCTUREs defined in the file. At this point, I cannot load CL-YACC, as the failures are that the STRUCTUREs in the DEFMETHOD specialization are not CLASSes. According to the Common Lisp HyperSpec, DEFMETHOD should be allowed to specialize on STRUCTUREs;.

"All classes defined by means of defstruct are instances of the class structure-class." --CLHS: structure-class

It appears that this changes DEFSTRUCT from just defining a type to defining a class. This seems to necessitate that CLOS would have to be fully integrated with Medley, not just as an "add on".

MattHeffron avatar Dec 06 '23 06:12 MattHeffron