yallop / ocaml-ctypes

Library for binding to C libraries using pure OCaml
MIT License
363 stars 95 forks source link

Better syntactic arity for fat pointer writes #760

Closed ncik-roberts closed 5 months ago

ncik-roberts commented 5 months ago

Change <-@ to have syntactic arity 2, not 1.

<-@ used to have syntactic arity 1, given that it is written as nested funs rather than a single fun with multiple parameters. In an upcoming version of OCaml 5, this difference will matter a little for performance, as the syntactic arity will start being used as the runtime arity. <-@ is usually applied to 2 arguments (I claim), so it's a little better for performance for it to have runtime arity 2 and therefore for those applications to be full applications.

This PR is a no-op for OCaml 5.1.1 and earlier.

yallop commented 5 months ago

<-@ is usually applied to 2 arguments (I claim)

I'm willing to believe that. Thank you for the contribution, @ncik-roberts!