I think part of the reason I wanted to do this is because I used to code in
Java, and in Java it's common to encapsulate variables and methods within
an object, and then have the object's methods reference itself. I guess
there's nothing stopping me from doing similar here, I could write
something like
function u(UF::UtilityFunction,consump,labor)
sigmac = UF.sigmac
sigmal = UF.sigmal
psi = UF.psi
consump.^(1-sigmac)/(1-sigmac) + psi*(1-labor).^(1-sigmal)/(1-sigmal)
end
but this is sort of ugly, so I'd prefer to avoid explicitly passing any
parameters, I also keep thinking that explicitly passing around parameters
should slow things down, so I've been reluctant to do it, but I just tested
it a bit. I haven't observed any performance loss. Perhaps I am conditioned
by MATLAB to avoid these things since it uses pass-by-value, so I believe
passing parameters makes copies there. Since Julia doesn't do this, there
shouldn't be a performance hit.