Replies: 3 comments 8 replies
-
Polymorphic Functions with Set-Theoretic Types (part 1 and 2) doesn't mention "gradual typing". Does this mean they only study fully statically typed languages here? I liked this paper about gradual typing + set-theoretic types: Gradual Typing with Union and Intersection Types (Castagna, Lanvin) https://www.irif.fr/~gc/papers/icfp17.pdf -- with the limitation that it doesn't solve polymorphism (IIRC) -- sort of similar to what we already have. I also liked (though hard to grasp) this one: Gradual typing: a new perspective (Castagna, Lanvin, Petrucciani, Siek) https://dl.acm.org/doi/10.1145/3290329 -- which uses a semantic approach rather than a syntactic one and solves polymorphism for set-theoretic types, but not subtyping... |
Beta Was this translation helpful? Give feedback.
-
Some news based on findings from #503 and #504. Having spent some time dogfooding the constraint solver, I see some limitations of the current implementation. In general, the limitations show up when dealing with intersection or union types. #503 shows that constraints generated based on a function intersection type lead to conflicts and type checking errors. Constraints from multiple patterns are applied to a single type variable, whereas in fact the type var stands for a type which would be handled by a single specific clause of the function. e643a0f shows a problem of pattern matching a union type in a negative position, i.e. as a return value, generating conflicting constraints. Strictly speaking, the problem is that each type var of the union is assigned constraints from both pattern clauses of the case expression, whereas in fact each of them is expected to match only one of the patterns. |
Beta Was this translation helpful? Give feedback.
-
The paper claims:
Which may not be correct - see eg https://luau-lang.org/2022/10/31/luau-semantic-subtyping.html - Roblox/luau has an order of magnitude more users than Erlang. |
Beta Was this translation helpful? Give feedback.
-
For some time now I've been researching the literature and sometimes it feels a little bit like playing bingo ;) These are the relevant keywords describing features of the type system that, I think, we need in order to type check Erlang:
map
s,fold
s etc; higher-order functions in generalAll in all, I've identified only three papers (having looked through far more) which seem to present type systems capturing all of the above features:
The first two are a bit disheartening due to the volume and complexity of the presented theory and, to be frank, I haven't read them in detail yet. They seem to be spot on with regard to the features they target, though. There's also a fresh PhD project by Guillaume Duboc lead by Giuseppe Castagna on applying this theory to create a type system for Elixir, but no published results yet. Another factor in favour of this model is that there are reference implementations available:
MLstruct, on the other hand, seems to be significantly lighter, but according to the author, it's not completely applicable to Erlang without introducing modifications. Fortunately, it also comes with a reference implementation and even with MLscript - an online demo of a language based on this type system.
All these publications are quite fresh, i.e. the oldest one is from 2019. It really seems a type system for Erlang is on the edge of the current research in the field 😅
@josefs @zuiderkwast do you have an opinion on the papers mentioned above? Which model, do you think, is better suited to Erlang? Or maybe there are other, more relevant, papers that I've not stumbled upon?
Beta Was this translation helpful? Give feedback.
All reactions