medley icon indicating copy to clipboard operation
medley copied to clipboard

SYMBOL-MACROLET missing from Medley Common Lisp

Open pamoroso opened this issue 1 year ago • 2 comments

Discussed in https://github.com/orgs/Interlisp/discussions/1643

Originally posted by pamoroso April 3, 2024 Does Medley Common Lisp support symbol-macrolet? The only relevant symbol I can find is internal in the LOOP package where the only references in sources/XCL-LOOP, here and here, don't define or implement it.

Here is a test session in an XCL Exec in Medley Online (19-Mar-2024 02:06:49). The code snippets are from the HyperSpec.

2/8> (apropos "SYMBOL-MACROLET")
LOOP::SYMBOL-MACROLET
SYMBOL-MACROLET
IL:|{DSK}<home>medley>il>demo>SYMBOL-MACROLET.DRIBBLE;1|
SYMBOL-MACROLET
2/9> (symbol-macrolet ((x 'foo)) 
   (list x (let ((x 'bar)) x)))
Undefined car of form
SYMBOL-MACROLET

2/10> 

2/10> (symbol-macrolet ((x '(foo x))) 
   (list x))
Undefined car of form
SYMBOL-MACROLET

2/11>

There's another symbol-macrolet reference (in XCL-USER?) with no definition. This is a fresh XCL-USER session where I haven't evaluated the symbol symbol-macrolet prior to the above snippets.

symbol-macrolet is indeed missing from Medley. The code in sources/XCL-LOOP is just a stub @masinter added to make Sacla loop work.

pamoroso avatar Apr 04 '24 15:04 pamoroso

There is an implementation of symbol-macrolet (macro not special-form) in: ftp.parc.xerox.com/pub/pcl/September-16-22-PCL-f.tar.Z, in the boot.lisp file. It appears to use the code walker in walk.lisp. I only found it. I haven't looked at it at any detail, nor tried to load it. I don't know what would be involved with making it a special-form, let alone just getting it minimally working.

MattHeffron avatar Apr 19 '24 23:04 MattHeffron

In Common Lisp a special form is allowed to be implemented as a macro but isn't required to be.

Apparently there was a move to implement a general code walker with templates for handling Common Lisp special forms and macros. I'm not sure -- it looked like there was some progress in using some parts of the code walker for Masterscope. _

masinter avatar Apr 20 '24 01:04 masinter