From e06e70a2212d6ec9e410df827e35ea21349530ac Mon Sep 17 00:00:00 2001 From: Miikka Salminen Date: Sun, 10 Nov 2024 12:15:23 +0200 Subject: [PATCH] Add Scala as a pl with somewhat different prior art --- text/3723-static-function-argument-unpacking.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/text/3723-static-function-argument-unpacking.md b/text/3723-static-function-argument-unpacking.md index 95a30049db6..4722c312344 100644 --- a/text/3723-static-function-argument-unpacking.md +++ b/text/3723-static-function-argument-unpacking.md @@ -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. | @@ -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]: "Crystal Language Formal Specification: Splatting a Tuple" [js]: "MDN JavaScript Reference: Spread Syntax (...)" [julia]: "Julia Manual: Varargs Functions" @@ -560,6 +564,7 @@ Table 2. Non-exhaustive summary of argument unpacking in different programming l [py-tut]: "The Python Tutorial: Unpacking Argument Lists" [py-ref]: "The Python Language Reference: Expressions - Calls" [ruby]: "Ruby Syntax Documentation: Calling Methods - Array to Argument Conversion" +[scala-spec]: "Scala Language Specification - Repeated Parameters" [tip-293]: "Tcl Improvement Proposal 293 - Argument Expansion with Leading {*}" [tip-157]: "Tcl Improvement Proposal 157 - Argument Expansion with Leading {expand}" [tcl-wiki]: "Tcl Wiki - {*}"