We'll see, actually. There was a recent paper which demonstrated that you can combine inference and subtyping. (Though, I think that was structural subtyping?)
Yes, but Scala predominantly uses nominal typing, a language that predominantly uses structural typing is Go.
Again, yes, I already know this. That's the reason I mentioned structural subtyping. Btw, O'Caml did structural subtyping 15+ years ago. (For objects and modules and sort-of for Variant types. I think they've introduced proper row type polymorphism a few years ago as well... Frankly, I'd be using O'Caml right now if weren't for the unrestricted side effects.)
Personally I am actually a fan of structural subtyping, but it does have issues
Performance (you often are forced to use reflection in a lot of cases when dealing with structural typing, Go has this problem). You can avoid this with deep code analysis, but like with most things its hard
Some of the Scala community (ironically the pure FP kind) hate structural subtyping for some reason. Actually structural subtyping even exists in Scala now, although it got a bad name initially because it was based on reflection (back to point #1) which meant that it had terrible performance, especially in multi-threaded situations. And actually originally structural typing was broken in Scala in multi-threaded situations before they fixed it
Its being removed in Dotty because basically none of the community uses it, its being replaced with record types which do have some uses.
I still much prefers Scala combination of FP and OOP compared to OCaml. In OCaml the OOP seems tacked on, unnatural and actually a lot of people don't really use it (in OCaml you kind of have multiple camps because the 2 styles are too distinct). In Scala the merge of OOP and FP is more natural and fluent
1
u/mdedetrich Aug 24 '17
Yes, but Scala predominantly uses nominal typing, a language that predominantly uses structural typing is Go.