Some weeks ago I tried to implement a new type in Julia which should 
basically behave like a subtype to an already existing type. Since Julia 
does not allow any subtypes of composite types, I wondered about a simple 
way to implement this. However, at that time I was not at all aware of all 
the intricacies that need to be considered and that are the reason why 
there is not one true simple way to achieve such an inheritance of 
behavior. 

By now, I found a way to overcome this problem, which at least suits my 
needs. Using Julia's meta-programming capabilities, you can sort of 
delegate the functionality from a "supertype" in a fairly simple way. 
Still, however, you need to put quite some thought into the process first. 
To save other people's time, I thought I'd just share my solution with 
anyone interested, and wrote a quite elaborate post about it on my blog: 

http://grollchristian.wordpress.com/2014/01/22/julia-inheriting-behavior/

Since I do not have a solid computer science background, I am thankful 
about everybody more sophisticated than me who gives it a glimpse, as I am 
rather unsure about some of the terminology (inheritance, objects, 
subclasses, instances,...). 

To give a little context: I did require this kind of inheritance of 
behavior for the package https://github.com/cgroll/TimeData.jl, where I 
implemented new types for time series data, which should rather feel like 
DataFrames to users. 


Reply via email to