My gut reaction is that you should not even try to do this. Here's other
options:
# recommended
myrand() = rand() + 1
# if you really need to use rand
immutable MyUselessType end
Base.rand(::Type{MyUselessType}) = rand() + 1
What's your use case that you feel you need to do this? You get into murky
territory trying to override such a core function.
On Tuesday, June 30, 2015 at 3:07:30 PM UTC-4, Deniz Yuret wrote:
>
> Say we import and redefine a function from Base. Is it possible to access
> the form of the function before the redefinition?
>
> Here is an example of what I am trying to do (which doesn't work):
>
> rand_orig = rand
> Base.rand()=(rand_orig() + 1)
>
>