Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #25733
| From | Ken Wesson <kwesson@gmail.com> |
|---|---|
| Subject | Re: Why “new”? |
| Newsgroups | comp.lang.java.programmer |
| References | <iii71v$3ud$1@lust.ihug.co.nz> <iiikhp$7s4$1@news.eternal-september.org> |
| Message-ID | <4d4cd875@news.x-privat.org> (permalink) |
| Date | 2011-02-05 05:56 +0100 |
| Organization | X-Privat.Org NNTP Server - http://www.x-privat.org |
On Fri, 04 Feb 2011 23:43:35 -0500, Joshua Cranmer wrote: > On 02/04/2011 07:53 PM, Lawrence D'Oliveiro wrote: >> Java copied C++ in using the word “new” to indicate class instantiation >> on the heap. (Of course, Java is different in not having any other kind >> of class instantiation.) >> >> But what purpose does this word serve? Java defines no meaning for >> “classname(args)” different from “new classname(args)”. How many >> hundreds of times a day do Java programms write something like >> >> classname varname = new classname(args); >> >> compared to, dare I say it, Python: >> >> varname = classname(args) >> >> I’m surprised Java never added a shorter form, say >> >> classname varname(args); >> >> which is of course straight out of C++. > > First off: `new' is a good visual indicator when quickly scanning code. > > Saving keystrokes is not all that important--if it were, then you'd end > up with wonderfully terse programming languages like APL. I don't care > if I can write a matrix multiplication in a single line of code, I won't > be able to understand it 6 months later (map #(map (partial dotp %) (transpose m2)) m1) Functional languages let you have that cake and eat it too. :) Although you'll probably need to use something like Haskell rather than a Lisp to get really good numerics performance using generic functional operations like map.
Back to comp.lang.java.programmer | Previous | Next | Find similar
Re: Why “new”? Ken Wesson <kwesson@gmail.com> - 2011-02-05 05:56 +0100
csiph-web