Article Discussion
What's New in Scala 2.8: Named and Default Parameters
Summary: The third installment of a series of articles on the latest Scala release, Scala 2.8, Jon Pretty describes Scala 2.8's support for named and default parameters.
2 posts.
The ability to add new comments in this discussion is temporarily disabled.
Most recent reply: September 29, 2010 0:56 PM by Valery
    Bill
     
    Posts: 409 / Nickname: bv / Registered: January 17, 2002 4:28 PM
    What's New in Scala 2.8: Named and Default Parameters
    September 21, 2010 9:00 PM      
    The third installment of a series of articles on the latest Scala release, Scala 2.8, Jon Pretty describes Scala 2.8's support for named and default parameters.

    http://www.artima.com/scalazine/articles/named_and_default_parameters_in_scala.html

    What do you think of how named and default parameters are done in Scala?
    • Lou
       
      Posts: 2 / Nickname: loumarco / Registered: November 21, 2007 4:37 AM
      Re: What's New in Scala 2.8: Named and Default Parameters
      September 22, 2010 0:51 PM      
      I was always a fan of features that help clarify code, even at the expense of increasing the word count.

      Of course, one man's clarity is another man's noise.

      Maybe I've spent too much time around IBM mainframes in my past where wordiness is a way of life!
      • Valery
         
        Posts: 1 / Nickname: vsilaev / Registered: February 10, 2007 9:00 AM
        Re: What's New in Scala 2.8: Named and Default Parameters
        September 29, 2010 0:56 PM      
        Lou,

        For me named parameters both add clarity and reduce noise:

        1. As a developer of some API code I prefer to have one method with optional named parameters rather than several overloaded methods that delegates to each other.

        2. As a user of some API I would prefer to type two-three short parameter names (or better yet have them all auto-suggested/completed by IDE) rather than select necessary method overload among 5-6 variants or type numerous nulls/zeros/empty-strings "default values" explicitly.

        For opponents of named arguments I would suggest the following:
        a) Try to add a weak-referenced event listener in AS3 via IEventDispatcher.addEventListener
        b) Try to open a password-protected workbook in MS Excel VBA via Workbooks.Open

        P.S. I never developed software for IBM mainframes, but I have some experience with SAP ABAP, so I pretend I may add a word on wordiness :)