Currently you can use `invoke`, although its future is uncertain:

https://github.com/JuliaLang/julia/pull/13123

--Tim

On Sunday, November 22, 2015 06:10:38 AM andrew cooke wrote:
> In OO programming it's quite common to delegate work to a supertype from
> within a method.  The syntax might be something like:
> 
> class Foo {
>     method bar(...) {
>         ...
>         super.bar(...)
>         ...
>     }
> }
> 
> I'd like to do the same in Julia, but don't know how to.  For example, I
> may have:
> 
> foo(x) = ....
> 
> which I want to call from within foo(x::Integer), say.
> 
> julia> foo(x) = "any"
> foo (generic function with 1 method)
> 
> julia> foo(x::Integer) = foo(Any(x))
> foo (generic function with 2 methods)
> 
> julia> foo(1)
> ERROR: StackOverflowError:
>  in foo at none:1 (repeats 79996 times)
> 
> doesn't work.
> 
> Can I do this, or do I need to pull the function out into a separate name?
> 
> Thanks,
> Andrew

Reply via email to