Scala Programming Language
  1. Scala Programming Language
  2. SI-3652

anonymous functions with repeated parameters

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Specification
    • Labels:
      None

      Description

      It looks like it is not possible to create a anonymous function with repeat parameters. The specification does not allow a type followed by a *.

      This looks inconsitent to me.

      scala> def foo(ss: String*) = println(ss.length)
      foo: (ss: String*)Unit
      
      scala> val bar = foo _
      bar: (String*) => Unit = <function1>
      
      scala> val doesnotwork = (ss:String*) => println(ss.length)
      <console>:1: error: ')' expected but identifier found.
             val doesnotwork = (ss:String*) => println(ss.length)
      

        Activity

        Hide
        Martin Odersky added a comment -

        This looks tempting at first, but it would drag in a lot of complexity (you just need to believe me on that one).

        Show
        Martin Odersky added a comment - This looks tempting at first, but it would drag in a lot of complexity (you just need to believe me on that one).

          People

          • Assignee:
            Unassigned
            Reporter:
            Michael Kebe
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development