Not allow function overloads which only diff in parameters' ranks#8140
Not allow function overloads which only diff in parameters' ranks#8140ke-yu merged 6 commits intoDynamoDS:masterfrom
Conversation
|
@ke-yu I don't see nodes for these built-ins: |
| } | ||
| } | ||
|
|
||
| return f; |
There was a problem hiding this comment.
Where do you check for the rank of the parameters here in order to return the function with the highest ranks?
There was a problem hiding this comment.
First come first serve. Suppose in delta execution environment we define a function and a properly working graph, now we define a overload which has higher rank of its parameter, then the original function will be pushed out of procedure table and the whole graph just stops working.
Instead of being smart, the rule is simple - take the first one.
|
@aparajit-pratap yep these builtins are obsolete, not available on UI. |
|
@ke-yu - I am completely fine with this approach. Function overloads that differ in parameter ranks were always confusing anyway, and IIRC this process started earlier with nodes like ExportToSat, etc. In short, LGTM |
Purpose
This PR disables function overloads which only diff in parameters' ranks. That is, the following function overloads are not allowed because parameter
xss have the same typeint(though with different ranks)But the following overloads are still valid:
The main purpose of this change is to reduce the complexity of method resolution for overloaded functions, especially in replication, and to make the program be more predicable from user's point of view. For example, in the following code, it is not so obvious which
foo()will be invoked.This PR removes overloads for the following builtins (Note even these builtins have been obsolete. They are replaced by functions in
Listnamespace)Equals(var[]..[], var[]..[]),Equals(var, var)IndexOf(var[]..[], var[]..[]),IndexOf(var[]..[], var)Insert(var[]..[], var[]..[], int),Insert(var[]..[], var, int)Print(var[]..[]),Print(var)GetType(var[]..[]),GetType(var)If there are overloads, the rule is the first one wins. There could be other more sophisticated rules, e.g., the function with higher rank parameter wins. One reason of using this simple rule is in delta execution environment, we don't want a newly added function disables its overload and makes the graph stop working.
Declarations
Check these if you believe they are true
*.resxfilesReviewers
@aparajit-pratap
FYIs
@kronz @Racel