The Artima Developer Community
Sponsored Link

Articles Forum
What's New in Scala 2.8: Named and Default Parameters

2 replies on 1 page. Most recent reply: Sep 29, 2010 4:56 PM by Valery Silaev

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 2 replies on 1 page
Bill Venners

Posts: 2251
Nickname: bv
Registered: Jan, 2002

What's New in Scala 2.8: Named and Default Parameters Posted: Sep 22, 2010 1:00 AM
Reply to this message Reply
Advertisement
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 Marco

Posts: 8
Nickname: loumarco
Registered: Nov, 2007

Re: What's New in Scala 2.8: Named and Default Parameters Posted: Sep 22, 2010 4:51 PM
Reply to this message Reply
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 Silaev

Posts: 5
Nickname: vsilaev
Registered: Feb, 2007

Re: What's New in Scala 2.8: Named and Default Parameters Posted: Sep 29, 2010 4:56 PM
Reply to this message Reply
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 :)

Flat View: This topic has 2 replies on 1 page
Topic: The Safe Bool Idiom Previous Topic   Next Topic Topic: Are Sloppy Résumés OK?


Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2014 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us