Hello,
I faced a strange problem. My code is working well in Julia Version 0.5.2 but facing problem in Julia 0.6.0. For sake of simplicity, I am giving small code mentioned below:
function s(x)
A1=AbstractString
for i=1:x
push!(A1,“$i”)
end
B1=AbstractString
B1=deepcopy(A1)
return A1,B1
end
Julia>T,S=s(10)
It is working well. If I am using the same logic for large problem then I am getting few issues. Function is generating few AbstractString and returning it to few variables. Within the function length of the AbstractString >0 . If we modify the stated function further as T,S=function!(arg1,arg2,…;t1=t1) where t1=false then we got T and S as empty AbstractString. The code and logic is Ok and working for Julia 0.5.2 but not for 0.6.0.Why T and S empty?
It’s unclear what you are actualy asking about. Your simplified code works just fine and you didn’t say what’s function!
, t1
, arg1
, arg2
.
FWIW, the B1=AbstractString[]
line is doing nothing good.
Ok. In layman word, t,x=s(2)
We will get value of t and x as per the logic of s(x). If we use isimmutable(s) then you will get true. if we use pointer_from_objref(s) then we will get void pointer. Question arises about the approach Julia version is using to return value to any variable. If t,x=s(2) then first array of AbstractString assigned by s to t should be by Ref. For some reason entire logic of the function can’t be given.
How are these related at all?
s
never assign anything to t
the caller assigns it.
What logic?