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


Groups > comp.lang.java.programmer > #25724 > unrolled thread

Re: Why “new”?

Started byOwen Jacobson <angrybaldguy@gmail.com>
First post2011-02-04 21:39 -0500
Last post2011-02-04 21:39 -0500
Articles 1 — 1 participant

Back to article view | Back to comp.lang.java.programmer

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Why “new”? Owen Jacobson <angrybaldguy@gmail.com> - 2011-02-04 21:39 -0500

#25724 — Re: Why “new”?

FromOwen Jacobson <angrybaldguy@gmail.com>
Date2011-02-04 21:39 -0500
SubjectRe: Why “new”?
Message-ID<201102042139219025-angrybaldguy@gmailcom>
On 2011-02-04 19:53:19 -0500, Lawrence D'Oliveiro said:

> Java defines no meaning for “classname(args)” different from “new 
> classname(args)”.

Not so. The former is parsed as a method call; the latter as a 
new-instance expression. Nothing, save good sense, prevents you from 
naming a method the same thing as a class (either the class containing 
it or some other class entirely).

A better comparison would've been to languages like Python, where class 
creation is little more than another kind of function call (both 
syntactically and semantically), or to Smalltalk, where instance 
creation is defined somewhat independently for each class in the system 
via a class method (and "core" library classes like Object provide the 
real machinery via virtual class methods, something absent from Java).

-o

[toc] | [standalone]


Back to top | Article view | comp.lang.java.programmer


csiph-web