Usually the answer to this is to factor your methods so this is unnecessary
(e.g. by having a secondary method that does the actual work). If that
doesn't work for you for some reason, there's also `invoke(bar,(Fu,),f)`
which does what you want.


On Wed, Jul 16, 2014 at 9:03 PM, Markus Roberts <[email protected]> wrote:

> Most multimethod systems seem to have a way to call the next-most-general
> method of a function, but I'm not seeing a good way to do that in Julia.
>  This is complicated by the fact that my sense of what's idiomatically
> clean in Julia isn't very well honed yet.  If Julia had CLOS's
> call-next-method I could get the results I'm looking for by writing
> something like:
> abstract Fu
>
> function bar(f::Fu)
>   print("Bar\n")
> end
>
> type Foo <: Fu
> end
>
> function bar(f::Foo)
>   print("Oooo...\n")
>   call-next-method()  #  <-- CLOS, not Julia
> end
>
> bar(Foo())
>
> ....(which I would expect to emit "Oooo...Bar\n").  Similar results can be
> obtained in other languages with "super", "inherited", etc. or by casting
> the appropriate argument to the (in Julia, abstract) parent type.
>
> My question: what's the "right" way to do this in Julia?
>
> -- MarkusQ
>
> P.S. An around-method analogue would work too, though it doesn't feel as
> semantically appropriate.
>
>

Reply via email to