Yes, old hat, and all explain how to do method overloading. I want to write a simple function, and overload it. And all remark — use OO… hmmm. So I played around with the basic concept of a router function, and overloaded functions.
This is the simple idea that you have different versions of a standard function, and the router, selects which one to call, base on the type and number of arguments provided. And then perhaps a default function to handle the call where none of the given type patterns fit.
Note a few things here — I am ussuming an operator +<- that is a “slim left arrow”, preceded with a +. For my idea the slim left arrow is read as “is being declared as”, and the +, is a overload indicator. I use this format a lot for what I call “declaratives”, but more on that in a next post.
Quite silly functions, but this way you can see what I’m trying to do. This code works of course. But the issue is, how do we define these overloaded funtions, and how do we translate it into this pure PHP? Of course, we write code to do it…