Method overloading leads to call first defined one if number of arguments does not match #13
正在加载...
在新工单中引用
屏蔽一个用户
没有提供说明。
删除分支 %!s()
删除分支是永久的。虽然已删除的分支在实际被删除前有可能会短时间存在,但这在大多数情况下无法撤销。是否继续?
删除分支是永久的。虽然已删除的分支在实际被删除前有可能会短时间存在,但这在大多数情况下无法撤销。是否继续?
Aer Information
d1b874b391
Your problem description
PH7 takes first method defined, if it does not match the arguments list.
This shows well below example, which defines 3 methods with the same name. Each of them takes different number of arguments.
Should we treat this as a bug or as a feature?
Expected results
As PH7 does not emit any errors, expected output is:
I take 0 arguments
I take 1 argument
I take 2 arguments
Current results
Actual result is:
I take 0 arguments
I take 1 argument
I take 2 arguments
I take 0 arguments
This behaviour might lead to subtle bugs I think.
I added variadic functions to the ideas for future releases. There are already a lot of things to do and I think we can skip this feature for now. I think P# should strictly match number of arguments for now, doesnt it?