-
Notifications
You must be signed in to change notification settings - Fork 94
Open
Labels
⚖️ programThis issue concerns some Catala programThis issue concerns some Catala program💡 languageLanguage designLanguage design💬 discussionFurther discussion is neededFurther discussion is needed
Description
As pointed for example in #917, we may need to clarify and implement ways of comparing elements.
Current situation
- (In)equality is polymorphic, automatically expanded to recurse into structures and enums (but that code is quick&dirty, terrible on enums)
- Comparing functions always returns
truefor equality (because that is most convenient in tests and assertions)
- Comparing functions always returns
- Comparisons are overloaded, and defined only for the base types
- Comparison on durations can raise exceptions
Options and ideas
- Just provide a list sort primitive with syntax,that takes the comparison operation as parameter
(might be verbose) - Define a "canonical order" on everything, enabling comparison to be structurally expanded, like equality
- Could be a lexical order on structs (by order of definition ? Alphabetical ?) and enums
- Define the ordering using some attributes, or extra syntax in the type definition ? (e.g.
#[sort.key = 1], #[sort.ignore]?) - Define comparison functions manually, with an attribute expliciting that they are to be used for comparing the selected type
- Other ideas ?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
⚖️ programThis issue concerns some Catala programThis issue concerns some Catala program💡 languageLanguage designLanguage design💬 discussionFurther discussion is neededFurther discussion is needed
Type
Projects
Status
Todo