Re: Last call for comments on SRFI 228: Composing Comparators
Marc Nieper-WiÃkirchen 16 Nov 2022 12:33 UTC
PS Alternative names:
- make-lexicographic-comparator
- make-linear-comparator
These names do not capture the type predicates of the constructed
generators (intersection and union types), but they capture their
ordering predicate, namely the lexicographic and the linear order.
By the way, this reveals a problem with the current SRFI
128-comparator proposal. They mix some very different things, namely
type predicate+order relation on the one hand and type predicate+hash
function on the other. Consumers usually only need one of the two
aspects (which are both optional), but not any. The name
make-lexicographic-comparator is strange when no order relation is
defined; on the other hand, make-intersection-comparator (or
make-product-comparator) is a name that does not specify the total
order at all.
PPS The longer I think about it, the more I believe that
make-product-comparator is not a good name because there is not really
a product (but some other kind of (categorical) limit).
Am Mi., 16. Nov. 2022 um 13:17 Uhr schrieb Marc Nieper-Wißkirchen
<xxxxxx@gmail.com>:
>
> Am Mi., 16. Nov. 2022 um 13:04 Uhr schrieb Lassi Kortela <xxxxxx@lassi.io>:
> >
> >
> > > - make-product-comparator and make-sum-comparator are defined to take
> > > zero or more comparators. It'd be better that the behavior when no
> > > comparators are explicitly stated. Or we may define them to take at
> > > least one argument.
> > +1
>
> There is no reason to restrict to >= 1 comparator. It would be an
> arbitrary restriction.
>
> > > - I'm implementing srfi-228 for Gauche from the srfi text and find the
> > > description of above two procedures a bit confusing, because the
> > > elements of comparators (type test, equality, ordering and hashing)
> > > are all written in one paragraph. How about itemize each element?
> > +1
> >
> > The names make-product-comparator and make-sum-comparator are quite
> > long. Could the "make-" prefix be dropped?
>
> I think Daphne's names are consistent with R7RS and the other relevant SRFIs.
>
> > The terms "sum" and "product" are obtuse. I assume they refer to math
> > (category theory?), as in sum and product types. Are there everyday
> > words that would say something close enough? The description is also
> > hard to understand.
>
> Instead of "product", "intersection" looks like a good choice because
> this is what happens with the type governed by this comparator.
>
> Then, one could replace "sum" with "union".
>
> > Anyway, the ability to compose comparators is a good one.
>
> I know that I would have to blame myself as well, but it is funny how
> often "last calls" elicit first comments by people!