I wrapped part of a C++ library:
type
gp_Pnt* {.importcpp: "gp_Pnt", byref.} = object
proc constructor_gp_Pnt(Xp: Standard_Real, Yp: Standard_Real, Zp: Standard_Real): gp_Pnt {.constructor, importcpp: "gp_Pnt(@)".}
proc SetX*(this: gp_Pnt, X: Standard_Real) {.importcpp: "SetX".}
When I use the library, I can create an instance using let or var, but I can use SetX in both cases.
Is there any trick to avoid allowing that? I mean, if I do: let pnt1 = Pnt(0.0,0.0,0.0), I shouldn't be able to call SetX.
proc SetX*(this: var gp_Pnt, X: Standard_Real) {.importcpp: "SetX".}
https://nim-lang.org/docs/manual.html#procedures-var-parameters