|
|
|
|
|
by NotableAlamode
4092 days ago
|
|
> () is used for function calls, grouping, and tuples, while [] is used for array literals and array indexing. Array indexing is a function call, because an array is a function from its index set to the set of the values the array stores, or -- equivalent -- a partial function from integers to the value set. Scala gets this right. |
|
I don't know, I never liked how all FunctionNs are sort of "unofficial" partial functions (because they may throw), and PartialFunctions are then made a subtype of FunctionN, because they have an extra method where you can ask whether they are defined at given points. Especially since throwing seems to be falling out of favor in Scala, being replaced by Try[] return types.