On Mon, Nov 23, 2020 at 8:04 PM Wolfgang Corcoran-Mathe <xxxxxx@sigwinch.xyz> wrote:

Amirouche raised the idea of an exact-integer -> enum-set conversion
(which he called "enum-set-unfold", a rather confusing name) in
https://srfi-email.schemers.org/srfi-209/msg/15202515/, but the
thread dropped after a short discussion.  Is this idea worth
revisiting?  The bitmap representation of enum-sets used by the sample
implementation means that this could be handled very efficiently,
which is a point in its favor.

It's a reasonable idea, though I don't think it's outright necessary.  If you want to implement it, I'll write it up.

Marc also requested syntax-case versions of define-enum, which I
will try to add to the sample implementation soon.

Makes sense.

Is there anything else that still needs to be addressed?

There remains the question of urging the use of (singleton) enum-sets rather than enums.  The idea of using enum-sets, which are strongly typed (in the sense of an enum-type) rather than bare enums makes sense if enums are symbols, as in R6RS.  When they are strongly typed objects (unique to a single enum-set) that doesn't arise.

In addition, the question of efficiency is quite unclear.  The enum equality function is identity (i.e. eqv?), whereas the enum-set equality function requires unwrapping the objects and then the more complex = test, where the time taken is proportional to the size of the enum type.

On Tue, Nov 24, 2020 at 6:28 AM Marc Nieper-Wißkirchen <xxxxxx@nieper-wisskirchen.de> wrote:
 
John promised to explain in the rationale why the extra complications of SRFI 209 (enum types, enum objects, associated values) compared with the quite basic (rnrs enumerations) are actually a good thing.

 New text:

R6RS enums ameliorate these disadvantages by providing "type-safe" sets, which can be stored more efficiently than general lists, possibly as integers. However, neither enum types nor enum objects are exposed, only enum names and enum sets. This means that R6RS cannot have a procedure that takes an enum-type and returns the enum of the type whose ordinal number is n, nor a procedure that takes an existing enum-type and creates an enum-set containing specified enums from it. Instead, it must use procedures that return a quasi-curried procedure for performing these operations on a specified enum-type. The nearest equivalent to an enum object in the sense of this SRFI is a singleton enum set. To perform an efficient test of enum set membership, it is necessary to use such a singleton, and comparing two such sets for equality involves = rather than eqv?.

Added and pushed.