Closed Lattay closed 4 years ago
I don't think a functional setter like with records is possible, b/c the Raylib types are opaque to the compiler (but I'd be happy to be proven wrong). I implemented setters for some types to reuse the C objects, like here or here. They don't return the new objects and instead work like setters in an object oriented language.
While implementing examples in PR #3 I end up doing a lot of creation of fresh Raylib objects, notably vectors and camera. I was wondering if it would be possible to add purely functional setters that would be a bit more efficient in returning a new object with some parameters changes, maybe by using the copy-on-write facilities from OCaml ?
I am not seasoned enough in OCaml to tell whether such a thing is possible but I think it would be great because right now, I am pretty sure the compiler cannot tell that the new camera I am allocating should replace the old one.