Hello,
I just tagged this Learning because I’m actually learning Ocaml/Reasonml so I’m not sure if what I’m going to say makes sense or not.
Also sorry but I’m going to use Reason syntax because it’s more familiar to me, but I admit that I like Ocaml more.
Being a javascript developer I use the expansion operator a lot, and I was quite happy to see that Ocaml/Reason supports it as well. However, it seems to be very limited to the application scope. For example, let’s say I have a function that returns a record, like this =
let shift = (session: exercisesList) => {
session: List.tl(session),
current: List.hd(session),
}
That function clearly returns a record, but I can’t do this:
let newRec = { ...shift (session) }
Neither this:
let info = shift (session)
let newRec = { ...info }
Seems that the only thing I can do is use records manually created.
Is there an alternative ? Am I doing something wrong ? Is this intentionally not supported ?