Member-only story
MUTABLE METHODS?! — A Julia Experiment
Trying to change the usage of functions on the fly with Julia types!
While pondering the addition of parallel computing to Lathe, my object-oriented machine-learning library for the Julia programming language, I thought up a very interesting idea. Julia is a rather dynamic language, and with a combination of polymorphism and method dispatch there is high potential of pursuing the idea of mutating methods. Of course, Lathe already has a standard set of functions that can be accessed as children of the type. These methods, however, can only serve one purpose or the other — meaning that if I wanted GPU support, I would either have to include it from the start with the method, have a conditional to hold GPU support, or write an entirely separate type up just to deal with GPU supported models.
None of these were good enough for me.
So with this frustration came innovation. What if we were able to alter a method’s logic by simply running another function? My idea can be demonstrated a little something like this.
yhat = LatheModel(Xtrain, ytrain).predict(Xtest)The code above is the code that would normally be used to fit and predict with a model using Lathe. My idea will…

