I can define a function that handles Integers:
function twice(a::Int64) a + a end
This function cannot handle Floats. If I want that, I need to define another method:
function twice(a::Float64) a + a end
But wait, this looks exactly the same, apart from the type definition. So, when I dream at night, there is a possibility to create such method definitions (everything identical apart from the type/combination of types) with a... macro maybe? Something like
@create_all_methods ("twice(a::$type ) a + a end", ["Int64", "Float64"])
Is this possible and if so, how?
Does the question maybe make no sense at all, because there is no situation where
function twice(a) a + a endwouldn't achieve the exact same thing anyway?
Thanks for your help in advance.