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


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

Re: Why “new”?

From Owen Jacobson <angrybaldguy@gmail.com>
Newsgroups comp.lang.java.programmer
Message-ID <201102042139219025-angrybaldguy@gmailcom> (permalink)
References <iii71v$3ud$1@lust.ihug.co.nz>
Subject Re: Why “new”?
Date 2011-02-04 21:39 -0500

Show all headers | View raw


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

Back to comp.lang.java.programmer | Previous | Next | Find similar


Thread

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

csiph-web