282: Additional R7RS (Type) Predicates

by Artyom Bologov

Status

This SRFI is currently in draft status. Here is an explanation of each status that a SRFI can hold. To provide input on this SRFI, please send email to srfi-282@nospamsrfi.schemers.org. To subscribe to the list, follow these instructions. You can access previous messages via the mailing list archive.

Abstract

Types and entities deserve predicates so that their user can meaningfully understand what they are dealing with, and usefully dispatch on them in their code. However, some R7RS “types” have no respective predicates. This SRFI defines them.

Table of contents

Issues

??? Optional section that may point out things to be resolved. This will not appear in the final SRFI.

Rationale

The discussion of types in Scheme is often predicate-reliant, including in the in R7 “Disjointness of types” section. Types are reliably represented by their respective predicates. (This is, in part, why the author’s own SRFIs rely on predicates for typing.)

But more predicates are needed than R7RS Small provides. There are types that do actually exist (i.e. are programmatically reachable,) but have no predicates referring to their existence. Some implementations provide these predicates, but there’s no portable way to use them. Thus this SRFI: to have a common ground set of predicates for entities that otherwise exist in most Schemes. And implicitly exist in the standard too.

Specification

The whole SRFI is split into sub-libraries, one predicate per library. This is because not all implementations support first-class objects these predicates check. Portable code relying on this SRFI can thus do:

(cond-expand
 ((library (srfi 282 environment)) #| Use environment? here|#)
 ((library (srfi 282 parameter))   #| Use parameter? here|#))

(srfi 282 environment) procedure (environment? object) → boolean

Returns true whenever given an environment object, as returned by environment and the like, and false otherwise.

(srfi 282 parameter) procedure (parameter? object) → boolean

Returns true whenever object is a parameter object, and false otherwise.

Not Included

record? and record-type?. While records and their types are also part of the standard type repertoire, they have respective SRFIs, like SRFI-237 and SRFI-76.

Earlier versions of this SRFI contained library? and syntax-transformer? predicates, but these were removed as too meta and impossible to obtain in standard code.

Implementation

Sample implementation not provided yet.

The simplest conforming implementation might be:

(define (environment? object) #f)
(define (parameter? object) #f)

Acknowledgements

Thanks to numerous individuals that contributed and continue to contribute to R7RS. This SRFI is by no means an attack on them, but rather a suggestion highlighting the lack of predicates for otherwise important entities.

Thanks to Marc Nieper-Wißkirchen, Peter Bex, and Peter McGoron for a discussion on some of the earlier / removed predicates (library?, syntax-transformer?, continuation?.).

Thanks to Wolfgang Corcoran-Mathe for a correct assessment of the language and tone of the SRFI initially being overboard.

Thanks to Arthur Gleckler for shepherding SRFI process all these years.

© 2026 Artyom Bologov.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


Editor: Arthur A. Gleckler