Right now this is a little tricky. It’s come up before and will probably have some kind of solution in the future.
For now, you might find http://grollchristian.wordpress.com/2014/01/22/julia-inheriting-behavior/ useful. — John On Jan 26, 2014, at 8:53 AM, Jesse van den Kieboom <[email protected]> wrote: > Hi all, > > I'm new to julia, so forgive me for maybe asking something obvious. What I > would like to do is to create a new type which is basically an Array{Float64, > 2}, but has some special operations defined as part of the vector space that > it belongs to. > > What I currently do is to create a new composite type with one field > containing the underlying array. This kind of works, but I need to proxy a > lot of operators (*, -, +, etc) and methods (getindex, setindex!, convert, > display, ndims, size), which do not need special behavior, to the underlying > array. > > Initially, I tried to use a typealias instead of a composite type, but it > seems the typealias type information is not retained and so I can't define > new operations on it. Does anyone have a better way to implement this?
