Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!feeder.news-service.com!2a01:348:65::2.MISMATCH!news-transit.tcx.org.uk!news.stack.nl!.POSTED!ipv6.urchin.earth.li!twic From: Tom Anderson Newsgroups: comp.lang.java.programmer Subject: Re: calling own methods from constructor Date: Fri, 8 Apr 2011 20:32:05 +0100 Organization: Stack Usenet News Service Lines: 21 Message-ID: References: <2011040622233261380-angrybaldguy@gmailcom> <2pzko2f2nx.fsf@shell.xmission.com> <2pwrj56744.fsf@shell.xmission.com> <2011040723213981856-angrybaldguy@gmailcom> NNTP-Posting-Host: ipv6.urchin.earth.li Mime-Version: 1.0 Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII X-Trace: mud.stack.nl 1302291126 51790 2001:ba8:0:1b4::6 (8 Apr 2011 19:32:06 GMT) X-Complaints-To: abuse@stack.nl NNTP-Posting-Date: Fri, 8 Apr 2011 19:32:06 +0000 (UTC) User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) In-Reply-To: <2011040723213981856-angrybaldguy@gmailcom> Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:2996 On Thu, 7 Apr 2011, Owen Jacobson wrote: > Could it have been designed differently? Sure. Java's constructor > semantics are a weird-but-mostly-intuitive mix of C++'s constructors and > Smalltalk's initializers-are-just-methods approach (where you're not > forced to chain to a parent class's initializer at all). Since we're talking other languages, i'll mention Python, where in a typical chained constructor: class Subprise(Surprise): def __init__(self): super(Subprise, self).__init__() not only is the call to the superclass __init__ method a perfectly normal call, so is the use of super()! tom -- the logical extension of a zero-infinity nightmare topology