Mercury Bugs - mercury
View Issue Details
0000577mercuryFeature Requestpublic2025-08-13 03:272025-08-13 03:27
Reporterzs 
Assigned To 
PrioritynormalSeverityminorReproducibilityhave not tried
StatusnewResolutionopen 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0000577: composite enums
DescriptionTypes such as the ext type in the compiler, which have

- several function symbols,
- all of which one argument,
- and all those arguments have types that are effectively enums,

should be themselves represented as one large enum.

Given e.g.

:- type t
   ---> f(t1)
   ; g(t2).

where t1 is an enum with values 0-12 and t2 is an enum
with values 0-42, then t should be such a "composite enum"
with values 0-55, with values 0-12 corresponding to function
symbol f, and values 13-55 corresponding to g (with the value
of g's argument being t's value minus 13.

The natural way to do switches on such composite enums
would be by binary search, not on the raw values, but on
the dividing lines between the integer ranges assigned to
the function symbols. Each binary step would rule out half
(rounded down) of the remaining possible function symbols.
TagsNo tags attached.
Attached Files

There are no notes attached to this issue.

Issue History
2025-08-13 03:27zsNew Issue