[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: enumeration set case syntax
- To: John Cowan <cowan@xxxxxxxxxxxxxxxx>
- Subject: Re: enumeration set case syntax
- From: Kevin Wortman <kwortman@xxxxxxxxx>
- Date: Sun, 22 Dec 2013 21:27:11 -0800
- Cc: srfi-113@xxxxxxxxxxxxxxxxx
- Delivered-to: srfi-113@xxxxxxxxxxxxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=348CARrRfOkbO1gR/fE2w+jlJnRIiNHbESTJIzwxY6c=; b=Q76B9Yn2M+5Bdyu61lXTVz8IpLpAi3BOr1CTmLTsY0MTZ0VowDuAZqNZ/KV0fb+Kh8 z8O5E/mSTzbN0Qyb9FOzsmtXgnWioqVUYTtT87xgY1SpR4ykOqXcvw4UcNGXS8DIZmsR XgA99IhN8JN9koHYPCmy27j4qZjQr3Bh3WxwNMrEgqAJwqF9uhoOc5CXL2b3hsB1Ljpg TD2uqb+SyjoyxHjLjxIPDt3XsIH7KTQpXU7ar1VIcHeMBHXq5AR6VpMuhB3SBStNL3rB f446vCEGvmyDh+qM/B8QMFJSFE94+mH8matwJNmxEgF0EMaMddUTbEuesluhu7D9t5wW h4vw==
- In-reply-to: <20131210201939.GJ591@mercury.ccil.org>
- References: <52A6BB4A.email@example.com> <20131210201939.GJ591@mercury.ccil.org>
- User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0
>> 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