Record creation with function

Hey, I discovered that the @obj directive was deprecated, due to the improvements on record creation in the new version of Rescript. But I was a big fan of having a “factory” for my custom types, not only to generate JS interop dictionaries, but to have a function, which is a better documented way of generating data for my models. eg:

I found this:

@obj
type person { name: string, email: string }

let myPerson = person(~name="john", ~email="bla@blaa.com")

better than this:

@obj
type person { name: string, email: string }

let myPerson = {name: "john", email: "bla@bla.com"}

Am I the only one who misses this functionality?

You can achieve something similar using an identity function:

type person = { name: string, email: string }

external person: person => person = "%identity"

let myPerson = person({ name: "foo", email: "bla@bla.com" })

but in that case you’re passing the record as parameter to the function, not labeled arguments;