Clearly the ingredient missing here is some evil type magic... Hint:

  immutable SelfFunction
    f::Function
  end

  selfcall(f::SelfFunction, t::MyType, args...) = f(t, args...)
  selfcall(f, t::MyType, args...) = f(args...)

  const inc2 = SelfFunction((t::MyType) -> begin
    selfcall(inc, t)
    selfcall(inc, t)
  end)

Reply via email to