[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: enumeration set case syntax

This page is part of the web mail archives of SRFI 113 from before July 7th, 2015. The new archives for SRFI 113 contain all messages, not just those from before July 7th, 2015.

>> How about a syntax similar to case, that dispatches based on a member of
>> an enumeration set, with enumeration-specific error checking?
>> Specifically, an error would be signaled if the cases are not
>> exhaustive, or if any clause datum is not a member of the enumeration set.
> Due to phasing problems, this would only work with enumerations defined
> using define-enumeration, and it would be awkward to implement it with
> syntax-rules only.  So I regretfully reject it for this SRFI.

You are correct about these issues. I think they could be sidestepped by
passing both an enumeration element and its purported enumeration to the
case syntax, and having the syntax check all the cases every time it is
evaluated. I expect that most programmers would consider this too
expensive, so I won't propose it for the SRFI, but I might write it as a
library later.

Kevin Wortman