|
|
|
|
|
by sachinjoseph
2227 days ago
|
|
The use use of '=' here scares me: function add2(x: Int, y: Int): Int {
return x + y;
}
add2(2, 3) //5
add2(x=2, y=3) //5
add2(y=2, 5) //7
The language already supports '=' operator for assignment of variables in the current scope, so should you use the same operator for denoting value assignment formal parameters in a function call? This can lead to a lot of confusion between variables in the scope and formal parameter names in a function that is called from the current scope. |
|