If you want to use julia functions like OOP methods just make the first
argument the object instance so
function setx!(s::State, i::int)
#modifies s, so we use "!" in function name
s.x = i
end
function squarex(s::State)
return s.x^2
end
#main code
s = State()
setx!(s,2)
#s.x == 2
y
Thanks. So the type instance is passed in as a parameter. My problem is
that if this is a remote call I can't see how to handle the state without
having a global instance of State. Something like this so I first remote
call somefunction() which sets some state and then remote call
anotherfuncti
it's not completely clear to me what you're asking. julia isn't
particularly object oriented (i just checked and there's no mention of
objects or classes in the intro at http://julialang.org/)
having said that, you can store and modify (unless the type is immutable)
values in composite types.