I prefer to use the following code: module MyCode floor(i::Integer) = Base.ifloor(i) floor(n) = oftype(n, Base.floor(n)) # code in this module that used floor, now has modified behavior to match my intent end
On Thu, Dec 26, 2013 at 10:09 PM, andrew cooke <and...@acooke.org> wrote: > when i have code like that i put the common code into a separate, local > function and then write two wrappers that pass in the functions that change. > > function generic_range(myfloor, myceil, ...) ... > histrange{T<:Integer}(...) = generic_range(ifloor, ...) > > (but i'm surprised no-one else has suggested that so perhaps there's some > issue i am missing), > andrew >