Hi Stefan,
Thank you for your reply. Let me explain in a bit more detail:
If instead of desuggaring 1 + 1 to +(1, 1), suppose it was desuggared to call(+, 1, 1), and similarly for a regular function call. foo(x, y, z) would become call(foo, x, y, z).
This, in many respects, is similar to the call overload for user-defined objects, but the issue I see is that the “first argument” is distinguished, Taking an example from the manual, for the type “Polynomial”, the overload would look more like
function call(p::Polynomial, x)
instead of the current
function (p::Polynomial)(x)
The “built-in” version would then look like
function call(f::Function, args…)
which is the actual function I would be interested in overloading.
Ultimately, I am trying to find a mechanism similar to the above where the first argument is not distinguished. For example,
abstract MyType
function call(f::Callable, x1::MyType, args…)
//Where Callable is just for illustration but typeof(+) <: Callable, typeof(foo) <: Callable and Polynomial <: Callable
or even
function call(f::Callable, args::Vararg{Union{MyType,Any}})
Does that make sense?
As an example of use consider partially applied functions:
type Placeholder
end
param = Placeholder()
pfoo = foo(1, 2, param, 3) //pfoo is now unary
I realize this may not be convincing use case but that’s actually not my problem; however, I thought it may illustrate the point.
Thanks for your time,
Tom