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. so, for example
julia> type State
x::Int
end
julia> function set(s::State, x::Int)
s.x = x
end
set (generic function with 1 method)
julia> function read(s::State)
return s.x
end
read (generic function with 1 method)
julia> s = State(12)
State(12)
julia> s.x
12
julia> s.x = 100
100
julia> s.x
100
julia> s
State(100)
julia> set(s, 32)
32
julia> s
State(32)
julia> read(s)
32
maybe that helps? obviously set and read are trivial to do directly on the
instance, but you could imagine more complex functions.
andrew
On Monday, 24 March 2014 16:32:41 UTC-3, Bob Cowdery wrote:
>
> Forgive me if this is daft and often answered question but I'm trying to
> get my head around Julia OO.
>
> Am I correct in thinking that as there is no binding between methods and
> types that I have to explicitly pass in an instance of a type to a method.
> If that is the case then how do I hold state on a remote object. I call a
> function that creates an instance of a type say something simple.
> type State
>
> sock
>
> end
> I just want to hold a socket reference. If the first remote function I call
> creates State then how can the next function I call obtain the state instance.
>
> Do I have to create a remote reference or something which it can use?
>
> Thanks
> Bob
>
>
>