egallesio / STklos

STklos Scheme
http://stklos.net
GNU General Public License v2.0
68 stars 17 forks source link

Fix a small glitch in `let-syntax` #605

Closed jpellegrini closed 10 months ago

jpellegrini commented 10 months ago

Hi @egallesio

This is about issue #604 --

The current let-syntax implementation doesn't work because it calls %find-macro-clause with 4 parameters, and a 5th was added.

stklos> (let-syntax ((f (syntax-rules () ((f) 10)))) (f))
**** Error:
find-clause: 5 arguments required in call to `#[closure find-clause]' (4 provided)

This patch changes let-syntax so it takes into account custom ellipsis symbols.

jpellegrini commented 10 months ago

So this now works:

stklos>  (let-syntax ((f (syntax-rules () ((f) 10)))) (f))
10
jpellegrini commented 10 months ago

One remark: perhaps we could also have, in the future, let-syntax for unhygienic macros? Something like

(let-syntax ((f (lambda (a b) 
                  ...)))
   (f 2 3))

Which would be similar to an internal define-macro... (For the future...)

egallesio commented 10 months ago

Thanks for the fix @jpellegrini.