Re: Comments on draft 1 of SRFI 288 Peter McGoron 27 Nov 2026 18:27 UTC

> When there is so much prior (and, perhaps, posterior) art you run the risk of providing too little, in deference to the “curse of compatibility”.
The reason I am very deferential to compatibility here is because I do
not want implementations to “support” this by having multiple
incompatible conditions systems. (Racket has the R6RS condition system
as a completely separate thing from its actual exception type
system[1].) Adapting exception objects is not straightforward: I spent a
lot of time trying and failing to adapt Chibi’s exception object system
to use compound conditions transparently.

If I were to disregard compatibility, then I do not see a reason to not
just adopt the R6RS condition+record system. It has a bunch of features
with the details figured out, and many implementations use it. But
people did not like that opinionated interface.

I’m pretty happy with how things turned out under the rather extreme
condition that STKlos, CHICKEN, MIT-Scheme, and Chez must all share the
same condition API.

 > For example, ‘simple-conditions’ can be very useful; I see no reason
to make it optional just because it wasn’t present in SRFIs 12 or 35.

I am in favor of moving up simple-conditions to being required. I may
ask implementations that do not supply it if this is unreasonably
difficult to implement.

 > The omitted inspection interface is another example.

I tried writing an inspection interface, but I found it impossible
without breaking both backwards and forwards compatibility. That is not
to say that one cannot be added later. But that will depend on
implementations converging on how to offer such interfaces.

> The overloading of the type predicate and accessors bothers me.  I know it’s convenient to extend these procedures to compound conditions,
but I think this overloading should be provided at a higher level.  The
fact that the primitive condition-type definition form doesn’t give you
a predicate that can unambiguously identify values of (just) that type
is a bad sign.
This is how SRFI 12, SRFI 35, and R6RS conditions work. I’m not sure
what the purpose of identifying specifically a define-condition-type
condition object is: it seems like trying to test for an object
specifically of a type and not of any of its subtypes. This might be
useful for implementation extensions, such as mutable condition types or
Java exceptions as condition objects, but I do not see where it would be
useful for define-condition-type conditions.

Making define-condition-type create non-compound-condition compatible
procedures is likely to cause issues, especially because the predicate
created by define-condition-type would fail silently where a user might
expect it to succeed. Example:

     (define-condition-type <my-condition>
       (my-condition thing)
       (my-condition?)
       (thing my-condition:thing))

     (my-condition? (condition (make-external-error) (my-condition 'a)))
     ⇒ #f

Additionally, it is allowed for simple condition types to be
representationally compound. That is not an absolute impediment to this,
but would be awkward: #<compound-condition my-condition> is
my-condition?, but #<compound-condition external-error my-condition> is
not my-condition?.

> I don’t quite understand how the field-name symbols are used.  The accessors seem to be defined entirely in terms of their order.  Are the
symbolic names there for error-reporting purposes?
They are for use by implementation extensions and documentation, similar
to the field names of define-record-type (R6RS and R7RS).

> The rules for coalescing conditions are a bit fiddly.

Yes. I’ll have to think about it a little more, and play with an
implementation of it. I might weaken it to just allow for coalescing of
condition objects with no fields.

> Should there be a compound-condition? predicate?

No, because simple conditions may be representationally compound. (See
above.)

> You refer to immutable condition objects.  Is there any way to create
mutable condition objects, or is this just “defensive specification”?

This is “defensive specification.” I should be specific that an
implementation may provide mutable condition objects.

> More predicate overloading: I don’t think the SRFI should specify the ghost of a condition hierarchy by making e.g. serious-condition? be true
of assertion violations as well.  Let implementations do this, if they
want.  It’s sufficient to leave it unspecified whether specific
condition types are disjoint from the others.
This is a collision of compatibility with R6RS and R7RS. R7RS error
objects are used by many implementations and users for what R6RS would
call assertion violations and errors (in this SRFI, assertion violations
and external errors).

We would either need to add some form of hierarchy (like the current
draft does), or abandon the R6RS dichotomy of assertion violations and
errors. This would make it difficult to interoperate code between the
R6RS condition system and this condition system. Personally, I like
assertion violations as a way to signal that the impossible has
happened, as a separate thing from an error that could happen but raises
an exception as its handling mechanism.

The hierarchy as defined by SRFI 288 is one defined only by predicates.
It is very flexible in terms of adapting implementation specifics.
Basically everything a system raises is a serious condition, and the
external-error? and assertion-violation? predicates can special-case
system conditions. The CHICKEN implementation[2] is an illustrative example.

Also, the overloading is a good example of how one can express important
parts of the R6RS condition type system in a simpler system.

> The note on assertion violations should be marked non-normative.

Everything in a box with “Note” or “Rationale” starting it is
non-normative. I will add an explicit statement.

> Thanks again.  I’ll keep reading.

You’re welcome!

[1]:
https://docs.racket-lang.org/reference/exns.html?version=9.3#%28def._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._exn%29%29

[2]:
https://github.com/scheme-requests-for-implementation/srfi-288/blob/master/chicken-lib/srfi-288.sld#L161

-- Peter McGoron