Type declarations for SRFIs? Artyom Bologov (05 Aug 2026 12:14 UTC)
Re: Type declarations for SRFIs? Peter Bex (05 Aug 2026 12:24 UTC)
Re: Type declarations for SRFIs? Artyom Bologov (05 Aug 2026 13:04 UTC)
Re: Type declarations for SRFIs? Wolfgang Corcoran-Mathe (05 Aug 2026 16:20 UTC)
Re: Type declarations for SRFIs? Wolfgang Corcoran-Mathe (05 Aug 2026 15:58 UTC)
Re: Type declarations for SRFIs? Artyom Bologov (05 Aug 2026 18:56 UTC)
Re: Type declarations for SRFIs? Philip McGrath (06 Aug 2026 00:55 UTC)
Re: Type declarations for SRFIs? Wolfgang Corcoran-Mathe (06 Aug 2026 20:26 UTC)
Re: Type declarations for SRFIs? Arthur A. Gleckler (06 Aug 2026 21:07 UTC)
Re: Type declarations for SRFIs? Artyom Bologov (06 Aug 2026 22:28 UTC)

Re: Type declarations for SRFIs? Wolfgang Corcoran-Mathe 05 Aug 2026 16:20 UTC

Peter,

On 2026-08-05 14:24 +0200, Peter Bex wrote:
> I don't know - those SRFIs seem overly dynamic, using things like
> predicates and disjoin/union.  The CHICKEN type system is a lot simpler.

I may be wrong, but I believe in Scheme it’s necessary to check types
dynamically, as in Artyom’s SRFIs, unless either (a) you have a way
to express gnarly types, or (b) you’re willing to ignore a variety
of possibilities.  For example, procedures can return various numbers
of various types of values depending on their arguments, something
that makes static typing of higher-order procedures a pain at best.
For another, static typing of procedures that juggle control requires
a type system which expresses Scheme’s first-class continuations.

(I don’t mean to bash CHICKEN’s type system, which I’ve used in most
of my CHICKEN libraries.  But I’ve had to resort to the ‘*’ result
type more often than I’d like.)

Whatever their runtime cost, contracts at least have the flexibility
to cover some of what Scheme offers.  First-class contracts can be
dynamically constructed and passed, which can allow checking of argument
procedures of higher-order functions.  (I don’t think Artyom’s SRFIs
support this yet, but it is possible.)  Continuations are harder —
I don’t know how much checking it’s possible to do (especially with
undelimited ‘call/cc’ continuations), but contracts using continuation
marks and barriers might be plausible.

--
Wolfgang Corcoran-Mathe  <xxxxxx@sigwinch.xyz>