>> > It would be interesting to learn why this is the case because I would >> think it should be. >> >> Have you read through the, I think linked, wikipedia article? You only >> need to read the Array section: >> >> https://en.wikipedia.org/wiki/Covariance_and_contravariance_%28computer_science%29#Arrays >> > Hi Mauro, > > Thanks for the link. That does explain it in the sense that I now know > Vector is invariant in Julia, but that begs the question, can we specify a > constructor to be covariant or contravariant in Julia?
I think this has been discussed (no references though), but it would make Julia more complicated. Scala can do it, but also has a reputation of being complicated... So, I suspect that it will not be added. > One of my longer terms dreams is to be able to do category theory in > Julia similar to Haskell > <https://en.wikibooks.org/wiki/Haskell/Category_theory>. It seems this > would be important to do categories properly.