branching different implementations inside a single function qualify to be called as "Overloading" ?
If yes, JavaScript.
lua.
Are you sure about it? I spent around 30 mins looking at "programming in lua" and didn't find anything about overloading. It's dynamically typed language, it can't have type-based overloading by definition. Even if it could dispatch function calls to different implementations based on parameter types, it would do this ONLY in runtime. Which is not overloading. Neither google gives me anything for "lua function overloading". It actually says the opposite - overloading is not supported. http://lua-users.org/wiki/OverloadedFunctions https://scriptinghelpers.org/questions/24647/does-lua-support-overloading-functions-two-identically-named-functions-with-different-parameters You can check original question, I dropped C example that demonstrates full support for overloading. It will work only if compiled with C++ compiler actually)) That's exactly why I'm looking for a good pure example - non-oop language that supports functions overloading both by parameter number and parameter types. Just like in my C/C++ example.
metatables in lua allow for overloading.
can you please give me some link with example? I am not familiar with lua, so it's very hard for me to understand where to search and what to search for)
Just search metatables in lua, you can choose which function get's called, when specific thing is passed to a metatable function, override it, etc...
Обсуждают сегодня