[julia-users] Re: Managing objects and state

2014-03-28 Thread James Fairbanks
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

[julia-users] Re: Managing objects and state

2014-03-25 Thread Bob Cowdery
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

[julia-users] Re: Managing objects and state

2014-03-24 Thread andrew cooke
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.