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 anotherfunction() which adds the parameter before it calls the realanotherfunction(). Having been warned away from using globals this seems a bad solution. Is there another way to do this?
type State x::int end s = State function somefunction() ... s.x = 1 ... end function anotherfunction() realanother(s) end realanotherfunction(s::State) ... s.x = 10 ... end On Monday, March 24, 2014 7:32:41 PM UTC, 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 > > >
