Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62169 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 95327 invoked from network); 15 Aug 2012 08:27:59 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Aug 2012 08:27:59 -0000 Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.42 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.215.42 mail-lpp01m010-f42.google.com Received: from [209.85.215.42] ([209.85.215.42:35311] helo=mail-lpp01m010-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 75/A3-06007-F8D5B205 for ; Wed, 15 Aug 2012 04:27:59 -0400 Received: by lahl5 with SMTP id l5so724571lah.29 for ; Wed, 15 Aug 2012 01:27:56 -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=zflHpZzNIK0KqROxn81zRi7wbJLH7SQHd05QgiZsHu4=; b=PtoWOjryHH05/4jt8Qhu+bLKqXFUsvHrwnkA/uySMGFkldoV62dmZbyIYCCQEvWeTB nwNsf1gXzG8fY7Ckq63yjz5n2JG27NWrd8lux/dGeOkOgkGWrPhunp91SRuDCkfC65S5 9+9mT8yPBLU85mAwVVqrloXHwy1HvIBxvJl9XPHEsEOaPBstBugxB+bkSfqb9QhQgFrX t/DN1M1I0HUbjNLVBHx+U1FOM6j6MftOV+mUNW2z4WAHAXH3Lpqp6t19W3vi75lgZKMN R8REQQamu8AKejYOsVZ4EDLTzKyrjoYy17KrhmxP2LoFbbE0LwiBPrSHJRqk6bmDeD4G U5Og== MIME-Version: 1.0 Received: by 10.112.25.4 with SMTP id y4mr9285424lbf.61.1345019276507; Wed, 15 Aug 2012 01:27:56 -0700 (PDT) Received: by 10.152.122.51 with HTTP; Wed, 15 Aug 2012 01:27:56 -0700 (PDT) In-Reply-To: References: <502A86AA.2030203@sugarcrm.com> Date: Wed, 15 Aug 2012 10:27:56 +0200 Message-ID: To: Stan Vass Cc: Stas Malyshev , Anthony Ferrara , Levi Morrison , internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] Inline typecasting / typehinting for classes and interfaces From: nikita.ppv@gmail.com (Nikita Popov) On Wed, Aug 15, 2012 at 10:06 AM, Stan Vass wrote: > I'd like to also ask people to read what the intended effect of the proposal > is instead of going into abstract discussions about how casting one class to > another doesn't make sense (this is not what's being proposed). I think you confused everyone by a) having "typecasting" in the title and b) starting with the (Foo) casting syntax (so everyone assumed that you indeed want some kind of class casts, whatever that may be). Regarding the actual proposal, could you maybe clarify the use-cases for this? I can see that it could be useful in principle, but your actually named use cases confuse me somewhat. In particular, I don't see how this would help dependency injection containers. I can see that it helps service locators and registries, but both of those are considered antipatterns, so there is no reason to add additional language features for them. DICs are only used to inject top-level dependencies, so in that case types should be fairly well covered by parameter type hints. Nikita