throw_again99
Re:Pyret – A language exploring scripting and functional programming
on Thursday December 15, 2016 @02:09PM (#13187224)
This is rather nice. You get a lot of convenience for that one type annotation!
Re:Pyret – A language exploring scripting and functional programming
on Thursday December 15, 2016 @01:23PM (#13186795)
Hi, thanks. Primarily I wondered about actual mixing of ADTs and objects, which is limited even in OCaml, see e.g.:
http://caml.inria.fr/pub/ml-archives/caml-list/2003/06/bed28...
But does Pyret always translate an ADT to a class hierarchy behind the scenes? This example sure looks like it does:
data Animal:
| elephant(name, weight)
| tiger(name, stripes)
| horse(name, races-won)
...
end
fun animal-name(a :: Animal):
a.name
end