Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #13439

Re: diamond operator

From Lew <lewbloch@gmail.com>
Newsgroups comp.lang.java.programmer
Subject Re: diamond operator
Date 2012-04-06 10:53 -0700
Organization http://groups.google.com
Message-ID <13661523.578.1333734815811.JavaMail.geo-discussion-forums@pbcr5> (permalink)
References <n4ann71plharl1ank5424uvqdi2ffpfh67@4ax.com> <2pmx6r31q4.fsf@shell.xmission.com> <4f7ec03d$0$6932$e4fe514c@news2.news.xs4all.nl>

Show all headers | View raw


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.
> >
> 
> IDE support is irrelevant in this discussion. Language syntax is not 
> about typing.

It is most certainly not irrelevant. Language support for the diamond operator 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 parameters. Every known source editor supports search-and-replace, so the refactoring effort is identical with or without the diamond operator. Every known source editor supports copy-and-paste, so there is not a whole lot of difference in yoctoergs exerted to write generic expressions. So am I harsh to judge the laziness and pettifogging petulance of those who clamored for the feature? Not hardly; if anything I'm being forgiving.

And, as I said earlier, that doesn't in the least prevent me from saving those yoctoergs myself. It's for readability, which actually is a distinct advantage of the diamond operator. I'm surprised no one else proffered that one real engineering advantage before this.

-- 
Lew

> 
> Code needs to be read and reasoned about. The better the syntax, the 
> less reading effort needed to be able to reason. Java's redundant syntax 
> in this respect is inefficient and the diamond operator takes away part 
> of that.

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

diamond operator Roedy Green <see_website@mindprod.com.invalid> - 2012-04-03 18:54 -0700
  Re: diamond operator Arne Vajhøj <arne@vajhoej.dk> - 2012-04-03 22:06 -0400
  Re: diamond operator Silvio Bierman <silvio@moc.com> - 2012-04-04 13:12 +0200
    Re: diamond operator David Lamb <dalamb@cs.queensu.ca> - 2012-04-04 08:23 -0400
      Re: diamond operator Silvio Bierman <silvio@moc.com> - 2012-04-04 15:40 +0200
      Re: diamond operator Arne Vajhøj <arne@vajhoej.dk> - 2012-04-04 19:41 -0400
        Re: diamond operator David Lamb <dalamb@cs.queensu.ca> - 2012-04-05 08:03 -0400
  Re: diamond operator Jim Janney <jjanney@shell.xmission.com> - 2012-04-04 10:23 -0600
    Re: diamond operator Lew <lewbloch@gmail.com> - 2012-04-04 18:15 -0700
      Re: diamond operator David Lamb <dalamb@cs.queensu.ca> - 2012-04-05 15:44 -0400
        Re: diamond operator Jim Janney <jjanney@shell.xmission.com> - 2012-04-05 14:54 -0600
    Re: diamond operator Silvio Bierman <silvio@moc.com> - 2012-04-06 12:06 +0200
      Re: diamond operator Lew <lewbloch@gmail.com> - 2012-04-06 10:53 -0700
        Re: diamond operator Joshua Cranmer <Pidgeot18@verizon.invalid> - 2012-04-06 21:35 -0500
          Re: diamond operator Arne Vajhøj <arne@vajhoej.dk> - 2012-05-05 20:07 -0400
      Re: diamond operator Jim Janney <jjanney@shell.xmission.com> - 2012-04-06 19:56 -0600
        Re: diamond operator Jim Janney <jjanney@shell.xmission.com> - 2012-04-06 20:02 -0600
  Re: diamond operator Arivald <NOSPAMarivald@interia.pl> - 2012-04-05 10:11 +0200
    Re: diamond operator Lew <lewbloch@gmail.com> - 2012-04-05 11:34 -0700
      Re: diamond operator Arivald <NOSPAMarivald@interia.pl> - 2012-04-05 22:02 +0200
        Re: diamond operator ObeseeExpen <ObeseeExpen.5ibto0@no-mx.forums.yourdomain.com.au> - 2012-09-03 12:39 -0400
      Re: diamond operator Joshua Cranmer <Pidgeot18@verizon.invalid> - 2012-04-05 18:18 -0500
      Re: diamond operator Arne Vajhøj <arne@vajhoej.dk> - 2012-04-05 19:38 -0400
      Re: diamond operator Silvio Bierman <silvio@moc.com> - 2012-04-06 17:07 +0200
        Re: diamond operator Thufir <hawat.thufir@gmail.com> - 2012-04-06 08:51 -0700
          Re: diamond operator Silvio Bierman <silvio@moc.com> - 2012-04-08 15:12 +0200
    Re: diamond operator Arne Vajhøj <arne@vajhoej.dk> - 2012-04-05 19:41 -0400

csiph-web