Skip to content

Commit

Permalink
Add Scala as a pl with somewhat different prior art
Browse files Browse the repository at this point in the history
  • Loading branch information
miikkas committed Nov 10, 2024
1 parent 7902d46 commit e06e70a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions text/3723-static-function-argument-unpacking.md
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ Table 1. Operator symbol alternatives.
| Prefix | `*` | Used in Python and Ruby for argument unpacking, in Kotlin for spreading. Clashes with dereferencing. |
| Prefix | `**` | Used in Python for unpacking dictionaries into named keyword parameters. |
| Prefix | `{*}` | Used in Tcl for argument expansion. |
| Suffix | `: _*` | Used in Scala for sequence arguments. |
| Prefix | `@` | At. Emphasis on _where_ the arguments come from. Used in PowerShell for splatting. |
| Prefix | `^` | Connotation of "up and out". Used for `XOR` in binary contexts. |
| Prefix | `~` | Connotation of "inverting the collection inside-out", or C++ destructors. |
Expand Down Expand Up @@ -542,8 +543,11 @@ Table 2. Non-exhaustive summary of argument unpacking in different programming l
| PowerShell | Splatting | `sum_four @nums` | [Reference][powershell] |
| Python | Argument unpacking | `sum_four(*nums)` | [Tutorial][py-tut], [reference][py-ref] |
| Ruby | Splat operator | `sum_four(*nums)` | [Syntax documentation][ruby] |
| Scala¹ | Sequence argument | `sum(nums: _*)` | [Language specification][scala-spec] |
| Tcl | Argument expansion | `[sum_four {*}$nums]` | [TIP 293][tip-293], [TIP 157][tip-157], [Wiki][tcl-wiki] |

¹ In Scala, the *sequence argument* is only accepted into a variadic parameter slot, if such is defined as the last parameter of a parameter section.

[crystal]: <https://crystal-lang.org/reference/1.14/syntax_and_semantics/splats_and_tuples.html#splatting-a-tuple> "Crystal Language Formal Specification: Splatting a Tuple"
[js]: <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax> "MDN JavaScript Reference: Spread Syntax (...)"
[julia]: <https://docs.julialang.org/en/v1/manual/functions/#Varargs-Functions> "Julia Manual: Varargs Functions"
Expand All @@ -560,6 +564,7 @@ Table 2. Non-exhaustive summary of argument unpacking in different programming l
[py-tut]: <https://docs.python.org/3.13/tutorial/controlflow.html#unpacking-argument-lists> "The Python Tutorial: Unpacking Argument Lists"
[py-ref]: <https://docs.python.org/3.13/reference/expressions.html#calls> "The Python Language Reference: Expressions - Calls"
[ruby]: <https://docs.ruby-lang.org/en/3.3/syntax/calling_methods_rdoc.html#label-Array+to+Arguments+Conversion> "Ruby Syntax Documentation: Calling Methods - Array to Argument Conversion"
[scala-spec]: <https://scala-lang.org/files/archive/spec/3.4/04-basic-definitions.html#repeated-parameters> "Scala Language Specification - Repeated Parameters"
[tip-293]: <https://core.tcl-lang.org/tips/doc/trunk/tip/293.md> "Tcl Improvement Proposal 293 - Argument Expansion with Leading {*}"
[tip-157]: <https://core.tcl-lang.org/tips/doc/trunk/tip/157.md> "Tcl Improvement Proposal 157 - Argument Expansion with Leading {expand}"
[tcl-wiki]: <https://wiki.tcl-lang.org/page/%7B%2A%7D> "Tcl Wiki - {*}"
Expand Down

0 comments on commit e06e70a

Please sign in to comment.