If you think generics have to be complicated, study OCaml’s generics. In particular, check out how hash tables and binary trees work without having to deal with typeclasses. I can hardly think of a language that gets “worse is better” better.
Those could just be (possibly nested) records of closures though. e.g. type reader = { read: byte array -> int } type reader_writer = { reader: reader, writer: writer }
-
-
That seems like pretty bad ergonomics.
-
Yeah, it may be worth adding better support for that pattern. It might be nice to unify closures and interfaces, in that case; closures are just a special case of interfaces where there’s one method…
- 2 more replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.