Re: LSP
Shelby <[email protected]>
| Newsgroups | gmane.comp.lang.scala |
|---|---|
| Message-ID | <[email protected]> |
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 -- 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.