Julia does not have classes so in that sense functions and data are 
separate. What Julia has as objects is composite types where state is 
maintained in the object. You then define methods on functions outside the 
type that operate on types. Because of multiple dispatch you cannot tie a 
function to a single object.

For example you have three composite types:

type ObjectA
    #fields for state
end

type ObjectB
    #fields for state
end

type ObjectC
    #fields for state
end

Now you can define three methods on a function the handles the interaction 
between the three objects:

function interact(a::ObjectA, b::ObjectB)
    #code here
end

function interact(a::ObjectA, b::ObjectC)
    #code here
end

function interact(b::ObjectB, c::ObjectC)
    #code here
end

This is quite convenient but it means you cant tie a function to a specific 
object.

On Wednesday, May 7, 2014 6:46:19 PM UTC+3, Neal Becker wrote:
>
> I've always used the following rule in languages such as python and c++ 
>
> If an object has state, use a class.  Otherwise use a function. 
>
> In languages lacking classes (and objects) e.g., FORTRAN, state must be 
> maintained outside of the object.  This is ugly and error prone. 
>
> How is this addressed in julia? 
>
>

Reply via email to