Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62198 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 82373 invoked from network); 15 Aug 2012 18:15:06 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Aug 2012 18:15:06 -0000 Authentication-Results: pb1.pair.com header.from=kris.craig@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=kris.craig@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.54 as permitted sender) X-PHP-List-Original-Sender: kris.craig@gmail.com X-Host-Fingerprint: 74.125.82.54 mail-wg0-f54.google.com Received: from [74.125.82.54] ([74.125.82.54:39494] helo=mail-wg0-f54.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 86/51-08779-A27EB205 for ; Wed, 15 Aug 2012 14:15:06 -0400 Received: by wgx1 with SMTP id 1so1294094wgx.11 for ; Wed, 15 Aug 2012 11:15:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=jm3geOaRtGjSUl106nKsegtIOMgYzFbfLu5eHNkyn5s=; b=bsNlTozkIHexZ5frM2/BNT5bl8g3bPAVN30N5ibTENdBJxH9LRk0STAKDCIgN82jLr AgrbgtahgL3QbJGg8+rU4MlqznBz0v1bCYyRnxZKA5Q+BicwBE9i6J0LcIh7IK6KxbIf SWOHRgtr0MOYZ0eX8/hAede59/QrunQ40GMSUwgz+oozO2obJ47W7KfIIjvj2lsDU16O RL+HPiIZZr8MAVZuJW+QR+z3Nrn1LXGP3Iua+428tTBr+trIpytDlU+0vTnfQ6jNUfEF UlOMZAMBu0yAq0Rk4deWTQzre9Htv1eVJRJbmreg9ap1WghEbk78njoQD7b6YoEVju/u rq8Q== MIME-Version: 1.0 Received: by 10.180.105.163 with SMTP id gn3mr77006wib.2.1345054502198; Wed, 15 Aug 2012 11:15:02 -0700 (PDT) Received: by 10.216.211.30 with HTTP; Wed, 15 Aug 2012 11:15:02 -0700 (PDT) In-Reply-To: References: <502A86AA.2030203@sugarcrm.com> Date: Wed, 15 Aug 2012 11:15:02 -0700 Message-ID: To: Anthony Ferrara Cc: Stan Vass , Stas Malyshev , Levi Morrison , internals@lists.php.net Content-Type: multipart/alternative; boundary=f46d04428466ce9ed904c751e747 Subject: Re: [PHP-DEV] Inline typecasting / typehinting for classes and interfaces From: kris.craig@gmail.com (Kris Craig) --f46d04428466ce9ed904c751e747 Content-Type: text/plain; charset=ISO-8859-1 On Wed, Aug 15, 2012 at 4:48 AM, Anthony Ferrara wrote: > Stan, > > On Wed, Aug 15, 2012 at 3:57 AM, Stan Vass wrote: > > > Hi! > >> > >> I agree with you. The one case where this syntax may be very useful is > if > >>> we want to implement class casting. So introduce a pair of magic > methods > >>> > >> > >> I do not think we want to implement class casting. I'm not sure how > >> class casting even makes sense - if the object is of one class, how can > >> you just make it into another class by casting? If you mean "casting" > >> actually returns another object of different class, then just make a > >> method for that that returns that object, I do not see how obscuring the > >> purpose of this operation with unobvious syntax would help. > >> > > > > The discussion is starting to drift very far from my original proposal. > > > > Instead of trying to guess what I mean, can't people just refer to my > very > > simple definitive proposed behavior? > > > > My point was that what I posted was the only way that I can see for the > original proposal to be useful. > > Anthony > Though I'm clearly in the minority on this, I for one think this proposal does have more merit than is being argued. There seems to be general agreement all around that this would provide a benefit as it pertains to code readability-- Not just by humans, but theoretically by doc/etc parsers as well. This is where we get into arbitrary, subjective territory. To me, that benefit in and of itself is sufficient to warrant this feature. To many of you, it is not enough. The tie-breaker for me is the fact that, though the benefits are modest, there's really no noticeable cost, either. The argument seems to, essentially, break down as follows: "This feature isn't worth our time." .... "Yes, it is!" .... "No, it isn't." There is clearly demand for this feature, even though its usefulness would be modest. Since it really wouldn't harm the language to just add it (if done correctly of course), my thinking is that we should just go ahead and add it. If nothing else, one benefit that hasn't been mentioned is the reduced traffic on Internals due to people no longer asking for it. ;) Just my three-and-a-half cents (damn inflation!). --Kris --f46d04428466ce9ed904c751e747--