It looks like OCaml native includes a built-in PPX for first class field accessors and setters:
https://dev.realworldocaml.org/records.html#first-class-fields
This is something that I miss from Elm. I think it’d be really nice to have first class fields in Reason as well. I tried using the [@deriving fields]
decorator on a record to see if it works, but it looks like BS doesn’t bundle that PPX, and just ignores the decorator.
Would someone be interested in trying to write a PPX like that on their own? Writing PPXs is a pretty cryptic topic, and IMO really lacking in friendly documentation, but it might be a fun project to take on. Referencing https://github.com/ryb73/ppx_decco by @ryb73 or https://github.com/jaredly/let-anything by @jaredly might be a good place to start.
Or, @bobzhang @chenglou would you be open to the idea of bundling that PPX with bsb (I don’t know if it’s that easy, just guessing here)?