Implementing Object Methods and Events?

I don’t think that’ll do quite what you think. It’s standard (but not required) to capitalize types in julia, and I will do so here to clarify.

struct MyType
    prop1
    prop2
    prop3
end

function f(x::MyType)
    return 2*x.prop1
end

# or the equivalent, less verbose version
f(x::MyType) = 2*x.prop1

This essentially means “if x is a MyType, use this method.” (Where “method” means “specific implementation of a function”, i.e. the version of a function for a specific signature)

2 Likes