You can make the parameter in the function be bar
type
MyObj = object
prop: string
proc doitWithObj(myObj: var MyObj) =
myObj.prop = "hallo"
var x: MyObj
x = MyObj()
x.prop = "bon jour"
echo x.prop
doitWithObj((x)
echo x.prop
# but it means it only works with var variables
let y = MyObj()
doitWithObj(y) # compile error
Run
- How to create a mutable object prefrably without ref halloleo
- How to create a mutable object prefrably without ref amadan
- How to create a mutable object prefrably without ref halloleo
- How to create a mutable object prefrably without ... Stefan_Salewski
