Re: Ambitious Work Artyom Bologov 03 Nov 2026 13:23 UTC

Amirouche,

>>> By the way, giving an example how that works with let-keywords, and
>>> let-optionals:
>>>
>>> https://synthcode.com/scheme/chibi/lib/chibi/optional.html
>> Optionals are an obvious extension, but they are not portable.
>
> They are portable, they rely on syntax-rules and rest arguments.

I’ve been unclear, sorry. By “not portable” here I meant “non-standard.”
Optionals are extremely implementation-specific and cannot be
introspected portably (and here I mean both portably.) Alex Shinn’s
implementation in particular compiles to raw lambdas with a single rest
argument, making any arguments non-introspectable at all. More portable
way to support optional arguments, case-lambda, is compiled to raw
lambdas on many implementations too. So yes, optional arguments cannot
be introspected portably.

However, prior discussion regarding case-lambda and multiple signatures
is influencing my decision-making tremendously. The next draft will
likely address that, but I yet have to think on how exactly it will.

> My question is about whether the tail of a dotted argument list can
> have heterogeneous types.

It can, but this is not expressible without resorting to
implementation-specific syntax and introspection. That’s why I ignore it
and focus on homogeneous dotted argument.

> Here is an example from the documentation:
>
> (define (make-person . o)
>   (let-keywords o ((name "John Doe")
>                    (age 0)
>                    (occupation job: 'unemployed))
>     (vector name age occupation)))
>
> (list (make-person)
>       (make-person 'name: "Methuselah" 'age: 969)
>       (make-person 'name: "Dr. Who" 'job: 'time-lord 'age: 1500))
>
> The rest argument called o contains either:
>
> - the empty list
> - (list 'name: "Methuselah" 'age: 969)
> - (list 'name: "Dr. Who" 'job: 'time-lord 'age: 1500))

Note that here the rest argument is a single thing that is only
destructured in the body of the procedure. So it cannot be inferred
unless implementation does really smart inference pass attaching type
info back to this rest argument and essentially turning it into
implementation-specific keyword/optional argument list. Which is wildly
outside of SRFI-283 scope and should belong to procedure-type-of instead
of procedure-check-of.

> As I read the draft, the dotted tail is one check applied to each
> element, so it can’t describe o here. Is that right?

Yes, you’re correct in reading this part. I have no satisfying response
that doesn’t delegate to implementations, I guess.

Thanks,
--
Artyom Bologov
https://aartaka.me