On 26 July 2013 03:19, Jonathan S. Shapiro <[email protected]> wrote:
> On Wed, Jul 24, 2013 at 2:57 PM, David Jeske <[email protected]> wrote:
>> If it was valuable to agree on the Ord implementation, presumably we would
>> be using a version of sort which parameterized the ord-comparator itself.
>
>
> You are arguing, in effect, that the choice of inlining strategy determines
> whether something is valuable. If so, that's complete nonsense.
>
> Parameterizing the ord-comparator makes sense only if we want to be able to
> sort in different ways at different times. Knowing what the standard
> ordering is is a matter of understanding the reference behavior of the
> procedure being called.
I keep going back over this conversation - I think you both raised an
interesting point, and I keep thinking that Shap is talking about the
int typeclass used for comparing array indexes when he's not. Maybe I
missed it, but I guess you're not trying to argue that typeclasses
that were not inferred from parametric argument types need to be
represented in the signature; not sure why I thought that.
Given these two signatures (with apologies for mixing the syntaxes of
four different languages to make it sufficiently expressive)
sort : {{x : Ord X}} -> x[n] %r -(mut %r)-> ()
sortR : R[n] %r -(mut %r)-> ()
where
sortR = sort {{ordR}}
in one crate, I later come along and say, well, I'd really like to
sort my array of R by the ordR ordering and so write
sort {{ordR}} rs
and that really, I probably hope to get sortR. So, besides actually
using sortR, is there a way I can get the correct sort instance AND
have it inlined and fast, since I've already compiled that?
I think that what you're trying to say, Shap, is that you would like a
way to compile the partial application and then retrieve it when I
make the same application. Which is really nothing about classes that
don't appear in signatures, because if you want to use a particular
ordering, you probably wouldn't use sortR because it doesn't take an
Ord instance.
Am I on the right track?
--
William Leslie
Notice:
Likely much of this email is, by the nature of copyright, covered
under copyright law. You absolutely may reproduce any part of it in
accordance with the copyright law of the nation you are reading this
in. Any attempt to deny you those rights would be illegal without
prior contractual agreement.
_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev