take an unnamed closure parameter, and refuse a variadic one

The closure's type was built from each parameter's second element, so
a type alone, or the ..., crashed sexc. A variadic closure cannot work:
its call helper would have to forward what C cannot.
This commit is contained in:
2026-10-18 22:02:55 +03:00
parent 315611ced0
commit 1393976bfc
3 changed files with 33 additions and 4 deletions

View File

@@ -12,7 +12,8 @@
"Captured pointer: 11 then 12"
"From a bare fn: 20 42 7"
"Captured array: 6 3, still 6"
"Captured const: 6")
"Captured const: 6"
"Unnamed parameter: 2")
(return 0)
;;; A closure is a code pointer beside its captures, so what this
@@ -135,4 +136,7 @@
(var k (const int) 5)
(var plus-k (closure ((int)) int) (closure ((v int)) int (k) (return (+ v k))))
(printf "Captured const: %d\n" (plus-k 1))
(var second (closure ((int) (int)) int) (closure ((int) (b int)) int () (return b)))
(printf "Unnamed parameter: %d\n" (second 1 2))
(return 0))