This page is no longer maintained — Please continue to the home page at www.scala-lang.org

Re: Re: Difference between List and Set variance?

4 replies
odersky
Joined: 2008-07-29,
User offline. Last seen 46 weeks 33 min ago.
On the issue of sets, I believe the non-variance stems also from the implementations. Common sets are implemented as hashtables, which are non-variant arrays of the key type. I agree it's a slighly annoying irregularity.

 -- Martin



On Sun, May 29, 2011 at 11:09 PM, martin odersky <martin [dot] odersky [at] epfl [dot] ch> wrote:


On Sun, May 29, 2011 at 1:23 AM, Kris Nuttycombe <kris [dot] nuttycombe [at] gmail [dot] com> wrote:
I'd like to chime in that I too think inheritance from the various
function types (for Map, List, Set, etc.) is wrongheaded and overly
limiting; implicits would be vastly preferable and could be
implemented without breaking source compatibility in most cases, as
was done with the collections library in 2.8.0. Much like equality,
one very frequently wants function semantics of collections to be
contextual and unrelated to the inheritance hierarchy.

Is there any chance of such a change being considered?

I think it's too late for that. We really have to take binary compatibility more seriously than up to now. And that means more or less freezing collections. Some small improvements, maybe, but there will be no more changes in the design.

 -- Martin




--
----------------------------------------------
Martin Odersky
Prof., EPFL and CEO, Typesafe
PSED, 1015 Lausanne, Switzerland
Tel. EPFL: +41 21 693 6863
Tel. Typesafe: +41 21 691 4967

Meredith Gregory
Joined: 2008-12-17,
User offline. Last seen 42 years 45 weeks ago.
Re: Re: Difference between List and Set variance?
Dear Martin,
Thanks for your input! If i understand correctly, it will be up to the community to grow some separate Set-like collections with consistent variance; and, if needed, provide views of these collections as functions. That sounds like a worthy task!
Also, just for my own understanding, can you provide pointers to information about the approach to binary compatibility? i'd like to verify for myself that Kris proposal cannot be made to work in a way that supports binary compatibility.
Best wishes,
--greg

On Sun, May 29, 2011 at 2:13 PM, martin odersky <martin [dot] odersky [at] epfl [dot] ch> wrote:
On the issue of sets, I believe the non-variance stems also from the implementations. Common sets are implemented as hashtables, which are non-variant arrays of the key type. I agree it's a slighly annoying irregularity.

 -- Martin



On Sun, May 29, 2011 at 11:09 PM, martin odersky <martin [dot] odersky [at] epfl [dot] ch> wrote:


On Sun, May 29, 2011 at 1:23 AM, Kris Nuttycombe <kris [dot] nuttycombe [at] gmail [dot] com> wrote:
I'd like to chime in that I too think inheritance from the various
function types (for Map, List, Set, etc.) is wrongheaded and overly
limiting; implicits would be vastly preferable and could be
implemented without breaking source compatibility in most cases, as
was done with the collections library in 2.8.0. Much like equality,
one very frequently wants function semantics of collections to be
contextual and unrelated to the inheritance hierarchy.

Is there any chance of such a change being considered?

I think it's too late for that. We really have to take binary compatibility more seriously than up to now. And that means more or less freezing collections. Some small improvements, maybe, but there will be no more changes in the design.

 -- Martin




--
----------------------------------------------
Martin Odersky
Prof., EPFL and CEO, Typesafe
PSED, 1015 Lausanne, Switzerland
Tel. EPFL: +41 21 693 6863
Tel. Typesafe: +41 21 691 4967




--
L.G. Meredith
Managing Partner
Biosimilarity LLC
7329 39th Ave SWSeattle, WA 98136

+1 206.650.3740

http://biosimilarity.blogspot.com
odersky
Joined: 2008-07-29,
User offline. Last seen 46 weeks 33 min ago.
Re: Re: Difference between List and Set variance?


On Sun, May 29, 2011 at 11:54 PM, Meredith Gregory <lgreg [dot] meredith [at] gmail [dot] com> wrote:
Dear Martin,
Thanks for your input! If i understand correctly, it will be up to the community to grow some separate Set-like collections with consistent variance; and, if needed, provide views of these collections as functions. That sounds like a worthy task!
Also, just for my own understanding, can you provide pointers to information about the approach to binary compatibility?

Mirco Dotta has recently categorized what incompatibilities can arise. He might be the best source to give more info.

Cheers

 -- Martin

Mirco Dotta
Joined: 2009-02-25,
User offline. Last seen 42 years 45 weeks ago.
Re: Re: Difference between List and Set variance?

> Also, just for my own understanding, can you provide pointers to information about the approach to binary compatibility?

We have developed a tool that will help you diagnose binary incompatibilities. We plan to get it out as a beta during Scala Days
(so just a few days from now!).

As for more detailed information on the sort of binary incompatibilities that the tool checks, I'm working on a document that I hope
will be soon public. It should help taking the right decisions when evolving your classes and traits. The form is similar to
Java's binary compatibility document (http://java.sun.com/docs/books/jls/second_edition/html/binaryComp.doc.html).

Of course if you have specific questions I'll be happy to answer them.

Cheers,
Mirco

Meredith Gregory
Joined: 2008-12-17,
User offline. Last seen 42 years 45 weeks ago.
Re: Re: Difference between List and Set variance?
Dear Mirco,
Thanks! i'm looking forward to your document and tool!
Best wishes,
--greg

On Sun, May 29, 2011 at 11:56 PM, Mirco Dotta <mirco [dot] dotta [at] gmail [dot] com> wrote:

> Also, just for my own understanding, can you provide pointers to information about the approach to binary compatibility?


We have developed a tool that will help you diagnose binary incompatibilities. We plan to get it out as a beta during Scala Days
(so just a few days from now!).

As for more detailed information on the sort of binary incompatibilities that the tool checks, I'm working on a document that I hope
will be soon public. It should help taking the right decisions when evolving your classes and traits.  The form is similar to
Java's binary compatibility document (http://java.sun.com/docs/books/jls/second_edition/html/binaryComp.doc.html).

Of course if you have specific questions I'll be happy to answer them.

Cheers,
 Mirco





--
L.G. Meredith
Managing Partner
Biosimilarity LLC
7329 39th Ave SWSeattle, WA 98136

+1 206.650.3740

http://biosimilarity.blogspot.com

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland