Hi Barney,

On Fri, Feb 24, 2012 at 2:00 PM, Barney Hilken <b.hil...@ntlworld.com> wrote:
> Every one of your messages about records stresses your dislike for 
> polymorphic projections, and your insistence that the Has class should be 
> hidden from the user. I've read all of your explanations, but I'm still 
> totally unconvinced. All your arguments about the semantics of labels are 
> based on the way you want to use them, not on what they are. They are 
> projection functions! Semantically, the only difference between them is the 
> types. Polymorphism makes perfect sense and is completely natural. There is 
> nothing "untyped" about it.

I share Greg's concerns about polymorphic projections. For example,
given a function

    sort :: Ord a => ...

we don't allow any 'a' that happens to export a operator that's
spelled <= to be passed to 'sort'. We have the user explicitly create
an instance and thereby defining that their <= is e.g. a strict weak
ordering and thus make sense when used with 'sort'. This explicitness
is useful, it communicates the contract of the function to the reader
and lets us catch mistakes in a way that automatically polymorphic
projections don't.

Automatically polymorphic projections feels like Go's structural
polymorphism, C++'s templates or C's automatic numeric coercions, and
I'm worried it'll lead to problems when used at scale. They're not
required to solve the problem we're trying to solve, so lets hurry
slowly and don't bake them in together with the namespacing problem.
At the very least use two different LANGUAGE pragmas so users can have
one without the other.

Cheers,
  Johan

_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Reply via email to