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


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

Re: Java 7 feature Q.

From Lew <lewbloch@gmail.com>
Newsgroups comp.lang.java.programmer
Subject Re: Java 7 feature Q.
Date 2011-08-13 22:13 -0700
Organization http://groups.google.com
Message-ID <f5971d45-a36a-41e5-a8f7-ddc23706b173@glegroupsg2000goo.googlegroups.com> (permalink)
References <j24m14$ju$1@speranza.aioe.org> <m7pd47dbquo11gb43i4f5ru3rel7mqj883@4ax.com>

Show all headers | View raw


Roedy Green wrote:
> "00101010" wrote, quoted or indirectly quoted someone who said :
>> Did they, like promised, add the waka waka shortcut for the instance 
>> creation operator?
> 
> I googled unsuccessfully. Waka Waka has meanings in the context of
> African pop music and Pac Man games, but nothing I could find on Java.

I had similar results when I searched.

> Perhaps you mean something like my suggested Bali syntactic sugar:
> 
> http://mindprod.com/jgloss/bali.html
> 
> BigDate d = new BigDate( 1997, 5 , 6 );
> 
> could be abbreviated:
> 
> BigDate (1997, 5, 6) d;
> 
> This does not require any new keyword.  Language designers have jumped
> through hoops to avoid new keywords, e.g. in generics.

Interesting and different guess from what Arne inferred.  This does point up the need for clarification from the OP.

OTOH, this was never a promised "waka waka" for Java.  Others have discussed elsewhere on the 'net (I think even in this newsgroup) the purpose of the 'new' keyword for constructors to distinguish them from methods that (against convention and good sense) match the class name.

Personally I don't find the extra four characters it takes to type "new " worth the trouble of changing the language to eliminate the requirement for it.  One can always follow Patricia Shanahan's and Joshua Bloch's advice to use a factory method instead of a public constructor.  This eliminates the need for a 'new' keyword in the expression, permits generic inference, allows power beyond mere construction, and admits of more expressive names than a mere copy of the class name, all without changing Java a whit.  No "waka waka" required.

-- 
Lew

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


Thread

Java 7 feature Q. 00101010 <zerozeroonezeroonezeroonezero@h2g2.cazoola> - 2011-08-12 22:03 -0400
  Re: Java 7 feature Q. Lew <lewbloch@gmail.com> - 2011-08-12 21:05 -0700
    Re: Java 7 feature Q. Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2011-08-13 07:17 +0000
      Re: Java 7 feature Q. Lew <lewbloch@gmail.com> - 2011-08-13 00:45 -0700
        Re: Java 7 feature Q. Lew <lewbloch@gmail.com> - 2011-08-13 22:05 -0700
      Re: Java 7 feature Q. Arne Vajhøj <arne@vajhoej.dk> - 2011-08-13 09:39 -0400
        Re: Java 7 feature Q. Lew <lewbloch@gmail.com> - 2011-08-13 09:25 -0700
        Re: Java 7 feature Q. Lew <lewbloch@gmail.com> - 2011-08-13 09:40 -0700
    Re: Java 7 feature Q. Dangling Pointer <dpointer2@gmail.com> - 2011-08-16 09:17 -0700
      Re: Java 7 feature Q. Jeff Higgins <jeff@invalid.invalid> - 2011-08-16 13:35 -0400
      Re: Java 7 feature Q. Lew <lewbloch@gmail.com> - 2011-08-16 13:13 -0700
      Re: Java 7 feature Q. Tom Anderson <twic@urchin.earth.li> - 2011-08-16 21:39 +0100
        Re: Java 7 feature Q. Robert Klemme <shortcutter@googlemail.com> - 2011-08-16 23:46 +0200
      Re: Java 7 feature Q. Jim Janney <jjanney@shell.xmission.com> - 2011-08-16 15:43 -0600
  Re: Java 7 feature Q. Roedy Green <see_website@mindprod.com.invalid> - 2011-08-13 14:00 -0700
    Re: Java 7 feature Q. Lew <lewbloch@gmail.com> - 2011-08-13 22:13 -0700

csiph-web