chapel icon indicating copy to clipboard operation
chapel copied to clipboard

Add keyComparator, keyPartComparator, and relativeComparator

Open jabraham17 opened this issue 7 months ago • 2 comments

This is an implementation issue for part of the new Sort module API from https://github.com/chapel-lang/chapel/issues/24857

This is a followup to https://github.com/chapel-lang/chapel/issues/25552, which should be implemented first

Instead of relying on special methods/records, the sort API will use interfaces. These interfaces work as follows

  • A record that implements keyComparator requires implementing the key method
  • A record that implements keyPartComparator requires implementing the keyPart method. Implementing the compare method is optional
  • A record that implements relativeComparator requires implementing the compare method

Any record that implements more than one of these interfaces should cause a compiler error

The Sort module implementation should use these interfaces when sorting to check if a comparator is valid, replacing the need for chpl_check_comparator

jabraham17 avatar Jul 12 '24 21:07 jabraham17