[R6RS] Enumerations proposal pre-draft

Michael Sperber sperber at informatik.uni-tuebingen.de
Sun Apr 23 11:53:19 EDT 2006

William D Clinger <will at ccs.neu.edu> writes:

>> - Having a new type allows for very fast dynamic type checking.
>>   Moreover, I suspect that it at least simplifies compile-time
>>   checking for compilers that already have the infrastructure for
>>   tracking record types through their flow analyses, but not sets of
>>   symbols.
> I don't see how the speed of run-time type checking would be
> faster with specialized enumeration values than with symbols.

Presumably, you have to go through the list of valid symbols to check
that a given symbol is a member.  With a separate type, you just have
to check the tag.

>> - The mapping to integers is much faster than with symbols.  This
>>   could also be exploited to produce very fast code for a case
>>   distinction, via tables or binary search.  (This may also be
>>   possible for symbols, but I don't see how.)
> Faster, yes, but not much faster.

That depends on the size of the universe, no?

> The speed of set operations is the same with symbols as with
> specialized enumeration values.

Don't you lose a bit at least at construction time, through the
overhead in converting to an integer?

Cheers =8-} Mike
Friede, Völkerverständigung und überhaupt blabla

More information about the R6RS mailing list