Re:Pyret – A language exploring scripting and functional pro...
by throw_again99 on Thursday December 15, 2016 @02:09PM
(#13187224)
This is rather nice. You get a lot of convenience for that one type annotation!
Additionally, Pyret's type system internally tracks each of the different constructors as a refinement on the type. With the animal example this would be represented internally as something like
if the type is known to only be an elephant. Though this is not used everywhere it could be right now it is part of the system. This means we have room to do things like if-splitting e.g. would be able to treat x as an in the body rather than just an `Animal`.