remove capture list from lambdas, they are always pure

Explicitly rename capturing lambdas to closures, they will be
implemented later
This commit is contained in:
2026-09-29 16:09:51 +03:00
parent ca88d9b386
commit aa5cfc1b7d
3 changed files with 20 additions and 25 deletions

View File

@@ -242,7 +242,7 @@
(let ((lambda-name (make-lambda-name (hash-table-ref env :fn-name)
(hash-table-ref env :lambda-counter))))
(set! (hash-table-ref env :lambda-aux-code)
(append (make-aux-lambda-struct lambda-name form)
(append (lift-lambda lambda-name form)
(hash-table-ref env :lambda-aux-code)))
(set! (hash-table-ref env :lambda-counter)
(+ (hash-table-ref env :lambda-counter) 1))
@@ -253,11 +253,9 @@
(string->symbol
(fmt #f "__lambda_" counter "_" enclosing-fn-name)))
(define (make-aux-lambda-struct name form)
(define (lift-lambda name form)
(match form
(('lambda arglist ret-type captures . body)
;; Captures are ignored for now, but
;; we'll need them for TODO: closures support
(('lambda arglist ret-type . body)
(process-fn (copy-form-source! form `(fn ,name ,arglist ,ret-type ,@body))
(list)))
(else (sex-error form "malformed lambda" form))))