Skip to content

Comment on Pain Points of OCaml

Comments

Usually partial function application is a bug

Dude, what?

I think this is true. It can be easy to accidentally do partial application, especially with optional and labelled arguments, eg:

  let bar x y z = …
  let foo w x = bar x (f w x)
The performance and evaluation order can be a bit surprising in this case, and the errors when updating bar can be hard to understand.

It's my favorite line of the whole thing. There's so much which can be derived from that single statement.

I would rather have partial function application be explicit rather than just omitting args because right now if you accidentally forget an argument (a bug) it isn’t an error there and instead becomes a type error somewhere else.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.