I’m not an expert on Julia but for what I researched it has no way to do this and should not do it, even this code does not make sense, if you want to generate a result give a return
and if you want to change the value of the variable that was used in the function call then assign it to the function result.
If it’s still that important to pass something by reference, which I doubt, then use a container with the value that can be changed, can encapsulate the value in a array and so the change within the function will be reflected outside, but it will still have to create that array, then take the value inside it. But again, it doesn’t make sense in most scenarios, especially an artificial one like this. As far as I know there is no way to change the behavior of an argument directly by value.
And why don’t you do it the right way and then you don’t need this?
– Maniero
You want something like
unsafe_store
?– Jefferson Quesado