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


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

Re: Why “new”?

Path csiph.com!eeepc.pasdenom.info!news.pasdenom.info!news.dougwise.org!nntpfeed.proxad.net!proxad.net!feeder1-1.proxad.net!198.186.194.247.MISMATCH!news-out.readnews.com!transit3.readnews.com!216.40.28.145.MISMATCH!novia!nx02.iad01.newshosting.com!newshosting.com!69.16.185.16.MISMATCH!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post01.iad.highwinds-media.com!newsfe22.iad.POSTED!00000000!not-for-mail
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>
MIME-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 8bit
Subject Re: Why “new”?
User-Agent Unison/2.1.3
Lines 19
X-Complaints-To abuse@UsenetServer.com
NNTP-Posting-Date Sat, 05 Feb 2011 02:39:21 UTC
Date Fri, 4 Feb 2011 21:39:21 -0500
Xref csiph.com comp.lang.java.programmer:25724

Show key headers only | 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