Return-Path: Delivered-To: apmail-harmony-dev-archive@www.apache.org Received: (qmail 45227 invoked from network); 23 Dec 2010 12:37:19 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 23 Dec 2010 12:37:19 -0000 Received: (qmail 92122 invoked by uid 500); 23 Dec 2010 12:37:18 -0000 Delivered-To: apmail-harmony-dev-archive@harmony.apache.org Received: (qmail 91775 invoked by uid 500); 23 Dec 2010 12:37:16 -0000 Mailing-List: contact dev-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list dev@harmony.apache.org Received: (qmail 91766 invoked by uid 99); 23 Dec 2010 12:37:15 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Dec 2010 12:37:15 +0000 X-ASF-Spam-Status: No, hits=4.2 required=10.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_BL_SPAMCOP_NET,RCVD_IN_DNSWL_NONE,RFC_ABUSE_POST,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [98.139.52.221] (HELO nm24.bullet.mail.ac4.yahoo.com) (98.139.52.221) by apache.org (qpsmtpd/0.29) with SMTP; Thu, 23 Dec 2010 12:37:07 +0000 Received: from [98.139.52.195] by nm24.bullet.mail.ac4.yahoo.com with NNFMP; 23 Dec 2010 12:36:46 -0000 Received: from [98.139.52.163] by tm8.bullet.mail.ac4.yahoo.com with NNFMP; 23 Dec 2010 12:36:46 -0000 Received: from [127.0.0.1] by omp1046.mail.ac4.yahoo.com with NNFMP; 23 Dec 2010 12:36:46 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 403029.33057.bm@omp1046.mail.ac4.yahoo.com Received: (qmail 47140 invoked by uid 60001); 23 Dec 2010 12:36:46 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1293107806; bh=/49Xin8S9liyNqaVftMD+ReGz7DAJ76nVwMWzpmivpE=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:References:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type; b=DnNq6JuB1LvJQtCXnP8RPFBixU5WNBE6GZJLiZO3b+zOPgq1MwqhHk5em8PvDeXZVds3qs9iXYYVYupVxkEOFjSsJDX32GFuHddrQ0bG6126dpwXKYw5qufDT3VGMlthr8670jBvVNz00nafSox2NA9mvNC5d5RvDACwYdoPSxw= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:X-YMail-OSG:Received:X-Mailer:References:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type; b=md8I1g2AkbMssRFn4LuBQZbHbltRDFcApnQFAh5DECSfDJ6SdDw9GFK9+zLtP+I4JCRZTvzngrNdwC3zarrPIh5Ip9p+YgkzoDrQrdwi/+G5vJcZ95mS1lQ/TMz4fb8lfEnkBL2ReW6aurK1TGHFEctpSMo8eMV30waDWxUwlWI=; Message-ID: <293245.47077.qm@web55904.mail.re3.yahoo.com> X-YMail-OSG: vJn0f1IVM1ljkIYMviSW1PquE0AJsr1VHzEsXgTAxu2zSGd OuA7ujRdIsSiC7cI01ngvjx45Wco1RxO0oC7UB5blxV6CnIo3RSeXLVaBrTk UwT0qK.3pI7DTMNvshGdsOFzErSHDyNyFUmoXE0LycN2R6eNqmIZP41e9QXH _QpWQyUgT75OFp0nOv8nOH1phtwk_dUkqX8vMNy9MRE4FWlFR4x124UVJriW fAaDC7iNmi1iZ2vxaMQ0zydBPVsdqB40qTigm6BQPBD52caScbvVC5Axt9on arN7jtNTBKy_zQ24HX6Zm5YBcuQIYblQaxjdk7uv_2vUYVEOWv0F59EoPRyj RRX_aVShSGNS9JYPLoE.bXMVzxHle8Sd_lsvdZuPkewFHnkJQomfPbwxeaJT RZevhf40O3pI- Received: from [218.248.84.90] by web55904.mail.re3.yahoo.com via HTTP; Thu, 23 Dec 2010 04:36:46 PST X-Mailer: YahooMailRC/553 YahooMailWebService/0.8.107.285259 References: <97274.78169.qm@web55903.mail.re3.yahoo.com> Date: Thu, 23 Dec 2010 04:36:46 -0800 (PST) From: hari ks Subject: Re: strong type cast needed in java. (overriding enhancement.) To: dev@harmony.apache.org In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-89485990-1293107806=:47077" --0-89485990-1293107806=:47077 Content-Type: text/plain; charset=us-ascii hi , c++ allows more combinations between instructions(functions) and data(variables) than java. eg in c++: base* b; sub* s; // sub extends base and both have method foo().. b -> foo(); // will call base foo() s -> foo(); // will call sub foo() s ->base::foo(); // will call base foo() java didn't add this mostly -because functions in super class might access 'private members' of super class which there is no way populating in subclass object and throw Null Exception.. Yet again - if these specific functions in superclass that could be accessed from subclass were compile time checked as not to access any private variable of super class, this feature may add meaning. There could be more better design than just preventing subclass not to access super class methods.. thanks & rgds, Hari ________________________________ From: "Jimmy,Jing Lv" To: dev@harmony.apache.org Sent: Thu, December 23, 2010 3:34:51 PM Subject: Re: strong type cast needed in java. (overriding enhancement.) Hi Hari, I see there is no such mechanism for Java now. I suppose it may be due to java single inheritance and dynamic bonding. Technically strong type casting is possible with bytecode instruction or something, however I'd rather design it clear to avoid such invoking - say, if you want A.foo(), create A a = new A(), or avoid overriding foo() in B. It sounds a syntax problem to invoke a parent method in a child class instance while the method is already overrode. It may have some problem with strong type casting. For an example, if you have a public basic type A, which has an implemented method foo(), and then create some internal implementation B, C, which C extends B and both of them override foo(). With a factory of A you can get an object "a" which is really C instances, then it will be hard to tell what can be invoked for a.super.foo()? Sorry I don't catch you that what is the benefit do you think for strong type casting on Java? 2010/12/23 hari ks > I have put up a post here : > >http://programparadigm.blogspot.com/2010/12/method-overriding-enhancements-strong.html >l > > > Suppose class B extends A. > A a = new B(); > ((A)a).foo(); // still calls class B's foo() method. > > Can something like "a.super.foo();" method invocation be made possible. Or > ((A > strong)a).foo(); should call A's foo() method with B's instance data. > > similar thing for C++. > > Is there a way to already do this? > > thanks & regards, > Hari > > > > -- Best Regards! Jimmy, Jing Lv --0-89485990-1293107806=:47077--