Path: csiph.com!aioe.org!.POSTED!not-for-mail From: =?UTF-8?Q?Arne_Vajh=c3=b8j?= Newsgroups: comp.lang.java.programmer Subject: Re: underscore as keyword in Java 9 Date: Wed, 27 Sep 2017 20:02:42 -0400 Organization: Aioe.org NNTP Server Lines: 30 Message-ID: References: <0b855e3b-6966-4f3b-bfdb-0863c64d7e39@googlegroups.com> <59c97591$0$2072$e4fe514c@newszilla.xs4all.nl> <59cbda67$0$20500$e4fe514c@newszilla.xs4all.nl> NNTP-Posting-Host: PBuS014lhzVyHjLbXmo/ZQ.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 X-Notice: Filtered by postfilter v. 0.8.2 Content-Language: en-US Xref: csiph.com comp.lang.java.programmer:37502 On 9/27/2017 1:05 PM, Silvio wrote: > On 26-09-17 02:24, Arne Vajhøj wrote: >> On 9/25/2017 5:30 PM, Silvio wrote: >> >> It is definitely shorter. >> >> I am not as convinced about more readable. > > The improved readability (as I conceive it) lies in the fact that there > is no need to match up two variable names. > > x => x.length > > requires my mind to note that the same identifier x is used twice: once > as formal parameter and once in the value expression. Having > > _.length > > makes that work redundant. But you have to be used to this to > immediately recognize the closure (lambda in Java speak). Since in > typical Scala source code the use of this shorthand is more frequent > than explicit closures one gets used to it really fast. I consider "readable by those used to it" to be "somewhat readable". But the problem may be very limited - I don't think those not having learned Scala will have much luck reading or writing Scala anyway. Arne