That's a trap. If a language is capable of doing it without some hackery
What exactly second lambda do? Your words about trap makes me uneasy. If it does som obscure thing that cannot be seen from code by people who do not know language well, you should explait what exactly code does.
Or you can use boost::any (*doit)(...); for different types and amount of input and output.
However I do not see usefulness of changing method to drastically different one in runtime: it leads to strange and unexpected behavior. For example what if code which expects previous version of method tries to call new?
Back to the example with extension language - it’s true that extending C++ with Lua is equivalent to using Python for both the application and extension language, it’s just that the latter so much easier. Not in theory, but in reality.
It still has nothing to do with type systems, though, or with the abstractive power of a language for that matter.
Ok, true - it is not that easily possible to change a method to a completely different one. Or to redefine a property to a property of a different type. I'm really curious, when can it be useful?