[r6rs-discuss] [Formal] Enumeration types should be reified

John Cowan cowan at ccil.org
Tue Jun 5 18:18:46 EDT 2007


---
This message is a formal comment which was submitted to formal-comment at r6rs.org, following the requirements described at: http://www.r6rs.org/process.html
---
Submitter: John Cowan
Email address: cowan at ccil.org
Issue type: Defect
Priority: Major
Component:  Enumerations
Report version: 5.93
Summary: Enumeration types should be reified

Currently, some enumeration procedures will work on two enumeration
sets if they have the same underlying universe (considered as a list of
symbols), but union, intersection, and difference depend on sharing the
same enumeration types.  However, there is no way to tell if enumeration
sets are of the same type except trying to union them and catching the
&assertion exception.  This comment proposes that the enumeration type
be made available to Scheme programmers.

Specifically, make-enumeration should return a unique opaque
enumeration-type object.  This would then be accepted by
enum-set-{universe, indexer, constructor} and the procedures returned
by the latter two.  Each enumeration-type object would be distinct in
the sense of eqv? from any other (so eqv? would need a new reference to
library section 14).

A new procedure enumeration-type would, given an enumeration set, return
the corresponding enumeration-type object.  While this design requires
one extra procedure, it clearly separates enumeration sets in their role
as sets from their role as prototypes.

-- 
John Cowan    cowan at ccil.org    http://ccil.org/~cowan
Objective consideration of contemporary phenomena compel the conclusion
that optimum or inadequate performance in the trend of competitive
activities exhibits no tendency to be commensurate with innate capacity,
but that a considerable element of the unpredictable must invariably be
taken into account. --Ecclesiastes 9:11, Orwell/Brown version




More information about the r6rs-discuss mailing list