Re: LSP

Shelby <[email protected]>
Newsgroups gmane.comp.lang.scala
Message-ID <[email protected]>
On Saturday, June 20, 2015 at 3:36:01 AM UTC+8, Shelby wrote:
>
> On Friday, June 19, 2015 at 12:30:04 PM UTC+8, Bardur Arantsson wrote:
>>
>> On 06/18/2015 11:48 PM, Shelby wrote: 
>> > On Friday, June 19, 2015 at 2:37:49 AM UTC+8, Bardur Arantsson wrote: 
>> > 
>> >> Uh, see the formal definition with is slightly below on the same 
>> >> Wikipedia page. 
>> >> 
>> >> And yes, it's very hard to *not* violate that rule. Hence "prefer 
>> >> composition over inheritance" and such guidelines. 
>> >> 
>> > 
>> > Seems it is easy to not violate is for covariant List[T] for as long as 
>> the 
>> > types in T don't use inheritance. Well I am not really making a point 
>> am I. 
>> > Because being covariant on its type parameter is not inheritance. 
>> > 
>>
>> Subtyping isn't really needed much in practice[1] if you have 
>> existential types. (See e.g. Haskell.) 
>>
>> (Of course you could argue that existential types are a limited form of 
>> subtyping, I guess.) 
>>
>> [1] AFAICT from my own experience. YMMV, of course. 
>>
>  
> I provided a reference which explains what you mean[1] in my Complete 
> Solutions to the Expression Problem[2]. I also had a S.O. answer on 
> subtying[3] that might be helpful for brainstorming.
>
> [1] 
> http://web.archive.org/web/20110605015801/http://homepages.cwi.nl/~ralf/gpce06/paper.pdf#page=8
>
> [2] 
> http://www.coolpage.com/copute/dev/docs/Copute/ref/Complete%20solutions%20to%20the%20%93Expression%20Problem.htm
>
> [3] 
> http://stackoverflow.com/questions/7266596/why-avoid-subtyping/8352969#8352969
>

Reviewing the resource cited[1] again, and also the following additional 
resource[4] that was linked from[2], I see that the conclusion appears to 
be that "open unions" are the extensible solution (not Existential types) 
and apparently "open unions" are not as easy to express as in Dotty (the 
new DOT calculus) because in Scala/Dotty a List[T] can be covariant on T 
(i.e. subtyped on its universal parameter which will be a union of types in 
the collection)?

I wish I could get some serious feedback on my idea in the thread, "The 
cake’s problem, dotty design and the approach to modularity", about 
automating the necessary boilerplate for this paradigm with the compiler. 
Seems that Haskell has determined this is the optimal approach, although I 
don't understand this tagless-final alternative from Oleg (because I don't 
read Haskell fluently enough to dig into his code examples).

 [4] http://lambda-the-ultimate.org/node/4394#comment-68060
      (start with slide 18 in the last link and followup with the reply to 
that post and the link Oleg's follow up reply)

-- 
You received this message because you are subscribed to the Google Groups "scala-language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.