Named parameters lead to inferior readability?

Posted by Thomas Jung on Stack Overflow See other posts from Stack Overflow or by Thomas Jung
Published on 2010-05-18T12:29:51Z Indexed on 2010/05/18 12:40 UTC
Read the original article Hit count: 242

Filed under:

With named parameters like

def f(x : Int = 1, y : Int = 2) = x * y

your parameter names become part of the interface

f(x=3)

Now if you want to change the parameter names locally, you are forced to perserve the public name of the parameter:

def f(x : Int = 1, y : Int = 2) = {
    val (a,b) = (x,y)
    a * b
}

If this a real problem? Is there a syntax to support this directly? Who do other languages handle this?

© Stack Overflow or respective owner

Related posts about scala