Hacker News new | ask | show | jobs
by heavenlyhash 2757 days ago
Interesting.

Random observations in no particular order:

- The simple assignment syntax looks somewhat procedural and is easy to read in small hunks at a time, but is still functional. I like this. This meshes well with the very real limits of how the human brain can parse things.

- I wish there were type declarations. There's a type system, but it seems to be all inference. Type declarations just at the function inputs and outputs (and leaving it pure inference in the middle) would promote readability when you've got no compiler in hand and are just eyeballing the pure text, in my opinion.

- I'm surprised by the inclusion of a system of nonlocal returns (panic/recover). It still looks relatively functional, but A) boy that's not an area where the word "relatively" is comfortable to use and B) I shudder to think what the inferred types will tend to explode into when using this feature (an Either of an Either of an Either of a ...?) in a nontrivial program (and the examples don't really shed light on that either, due to the "all inference" model leaving us with no plain text declarations of types in sight).

- I haven't seen any examples yet of what happens and how you're supposed to resolve it when the type inference can't quite figure it out. There seem to be some examples of doing explicit casts which seems to be a workaround for this, but I don't see it discussed very clearly.

- The quick and easy syntax for returning new record/structure types seems nice. Though I'm again a tad worried that the range of types I could end up producing would get pretty large.

- The syntax holistically seems to keep things from "drifting to the right", which seems to be a common readability cramp that emerges in many functional languages. Nice.

- Using the term "Variety" for roughly "closure" is... very nonobvious to me. But I shouldn't nitpick on terminology. (And for what it's worth, I read the protobuf that Ko uses internally to define its types of types before anything else, and so maybe I'd be less surprised if I had encountered it from from the docs and lessons first.)

Caveat: these are all "hot takes" from the couple dozen minutes of digging I've done so far. I might be reading some things wrong or have missed some documentation, so take these comments with a grain of salt and do your own looking as well.

Overall, this seems neat, but simultaneously leaves me a little worried that I'd be able to too easily write things in which the type inference finds something that compiles, but isn't the type that I would've declared.

I'd be really interested to see what this shapes up like if combined with some system for explicit type declaration. Gluing Ko together with a serial data schema like Protobuf and using Ko for "migrations" seems like it could be a really useful combination, for example.

1 comments

Yes, type declarations are documentation, and tell me about as much, or more, about a function than its name, when reading e.g. Haskell code. They are a necessary usability feature.