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? Peter Bex 05 Aug 2026 12:24 UTC

On Wed, Aug 05, 2026 at 04:13:56PM +0400, Artyom Bologov wrote:
> Hi y’all,
>
> How would you look at a project rigorously documenting types of all (or
> most) SRFIs? This might allow statically typed implementations like
> CRUNCH to easier infer types. Also helps to write more performant
> code. And allows to understand the shape of args for a given procedure.
>
> I’m not going to pull it off alone, though. Thus the question: is anyone
> interested in such a project?

I think it would be very useful!

> The format I suggest is SRFI 273 declare-checked
> <https://srfi.schemers.org/srfi-273/srfi-273.html#spec--declare-checked>
> with a set of combinators from SRFI 235
> <https://srfi.schemers.org/srfi-235/srfi-235.html> to have union
> (disjoin) and complement types.

I don't know - those SRFIs seem overly dynamic, using things like
predicates and disjoin/union.  The CHICKEN type system is a lot simpler.

For most SRFIs packaged as CHICKEN eggs we already define some types,
but it's using the CHICKEN "external types" file, which is a purely
static way of declaring types (a bit like declare-checked, but with a
predefined set of types).

As a simple example, here are the types for srfi-13:
https://anonymous:@code.call-cc.org/svn/chicken-eggs/release/6/srfi-13/trunk/srfi-13.types

For more info on the type declarations themselves, see this:
https://wiki.call-cc.org/man/6/Types

> Is there a need for such a thing?

It would be even better if new SRFIs came with type declarations in the
reference implementation.

Cheers,
Peter