Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: Lew Newsgroups: comp.lang.java.programmer Subject: Re: diamond operator Date: Fri, 6 Apr 2012 10:53:35 -0700 (PDT) Organization: http://groups.google.com Lines: 48 Message-ID: <13661523.578.1333734815811.JavaMail.geo-discussion-forums@pbcr5> References: <2pmx6r31q4.fsf@shell.xmission.com> <4f7ec03d$0$6932$e4fe514c@news2.news.xs4all.nl> NNTP-Posting-Host: 69.28.149.29 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1333734816 11752 127.0.0.1 (6 Apr 2012 17:53:36 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 6 Apr 2012 17:53:36 +0000 (UTC) In-Reply-To: <4f7ec03d$0$6932$e4fe514c@news2.news.xs4all.nl> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=69.28.149.29; posting-account=CP-lKQoAAAAGtB5diOuGlDQk0jIwmH0T User-Agent: G2/1.0 X-Received-Bytes: 3129 Xref: csiph.com comp.lang.java.programmer:13439 Silvio Bierman wrote: > Jim Janney wrote: >> Roedy Green writes: >>> I was looking over the table of contents of a book about new features >>> in Java 7 and came across a reference to the "diamond operator". >>> >>> It turns out to be simple, but one of the precious bits of Java >>> syntactic sugar to make it terser. >>> >>> http://fahdshariff.blogspot.ca/2011/07/java-7-diamond-operator.html >>> >>> http://mindprod.com/book/9781849685627.html >> > > This isn't wrong, but it fixes a problem I never knew I had. Any > > competent IDE will expand that for you anyway. > > >=20 > IDE support is irrelevant in this discussion. Language syntax is not=20 > about typing. It is most certainly not irrelevant. Language support for the diamond opera= tor was motivated by the desire of a certain constituency to avoid typing. = The kind you do on a keyboard, not the kind to declare variables. The language itself was just fine with redundant expression of generic para= meters. Every known source editor supports search-and-replace, so the refac= toring effort is identical with or without the diamond operator. Every know= n source editor supports copy-and-paste, so there is not a whole lot of dif= ference in yoctoergs exerted to write generic expressions. So am I harsh to= judge the laziness and pettifogging petulance of those who clamored for th= e feature? Not hardly; if anything I'm being forgiving. And, as I said earlier, that doesn't in the least prevent me from saving th= ose yoctoergs myself. It's for readability, which actually is a distinct ad= vantage of the diamond operator. I'm surprised no one else proffered that o= ne real engineering advantage before this. --=20 Lew >=20 > Code needs to be read and reasoned about. The better the syntax, the=20 > less reading effort needed to be able to reason. Java's redundant syntax= =20 > in this respect is inefficient and the diamond operator takes away part= =20 > of that.