4 ms·
Nice! So it looks like polymorphism is done via C++ template-style ad-hoc polymorphism? Are there any restrictions on it? Also, is there any kind of sophistica
by tines 1y ago
Nice! So it looks like polymorphism is done via C++ template-style ad-hoc polymorphism? Are there any restrictions on it?
Also, is there any kind of sophisticated pattern matching? I feel like for me a language without pattern matching is a non-starter these days.
- Aardappel 1y agoYes, its somewhat similar, monomorphic specialization. I am sure it has some limitations, but it is pretty powerful, it can even do things C++ can't, like have a type error in a branch that in the current specialization is never executed doesn't count as a type error :) There's no FPL style pattern matching. It can do a switch case on types (the various subclasses of a base class) but only 1 level, i.e. can't match against type of members. That could still be added, just personally rarely have use for it.
- tines 1y ago> like have a type error in a branch that in the current specialization is never executed doesn't count as a type error I’ve struggled with my feelings on this even to the extent that C++ allows it, because while it is flexible, it can also hide errors in libraries that will only blow up when used in very specific ways.
- Aardappel 1y agoYes, that is a downside, but when you write very generic code being limited in what code you can write because it has to typecheck even for types that it doesn't apply to is one of the more frustrating things of doing this in C++ and other languages.