Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:63473 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 98592 invoked from network); 16 Oct 2012 16:32:13 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Oct 2012 16:32:13 -0000 Authentication-Results: pb1.pair.com smtp.mail=amaury.bouchard@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=amaury.bouchard@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.160.42 as permitted sender) X-PHP-List-Original-Sender: amaury.bouchard@gmail.com X-Host-Fingerprint: 209.85.160.42 mail-pb0-f42.google.com Received: from [209.85.160.42] ([209.85.160.42:41358] helo=mail-pb0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id EA/70-29764-C0C8D705 for ; Tue, 16 Oct 2012 12:32:13 -0400 Received: by mail-pb0-f42.google.com with SMTP id ro2so6219416pbb.29 for ; Tue, 16 Oct 2012 09:32:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; bh=cnH1qr5EMWwvJ+BDt9i2bOPcMCel+iXmZwfLE8J7vW0=; b=b+KNho2/Ipz67SBfZCNLQt3FBFY2IIhVRRJCCKoZ5ciJZkikYPxOc81CEPY43Kg94n kiuoIThS/emmxUxMvaQcvLYgEReZ6KR3t+vfCaxg7hzjyffg+xTmMfCmY8L9kc2FX31+ hdjbDR6CG88TSviq9nV7upFidWGQ/HywNGHQLkqql1T2Y8eFH+3DfeOVfrh1Hvr/EfHi HP9JoXACKpWv+VocNHCk7fjnHSj0k5x1s9Btsfi506hsuOOPvro4Sr58YgCLmhfv1TBW FNZDjM2JbAl1gn+2ScxQ0hcoUNF/LWT/PjbRMIpoNvz87waVsglh8dJQJywPFUbzs+8t 2fKg== Received: by 10.68.132.165 with SMTP id ov5mr47685790pbb.105.1350405130118; Tue, 16 Oct 2012 09:32:10 -0700 (PDT) MIME-Version: 1.0 Sender: amaury.bouchard@gmail.com Received: by 10.68.203.168 with HTTP; Tue, 16 Oct 2012 09:31:49 -0700 (PDT) In-Reply-To: <507D801E.7070508@lerdorf.com> References: <9570D903A3BECE4092E924C2985CE485612B6434@MBX202.domain.local> <507D133A.4040701@sugarcrm.com> <507D801E.7070508@lerdorf.com> Date: Tue, 16 Oct 2012 18:31:49 +0200 X-Google-Sender-Auth: bMPqYFVP3HCfJGssA9qBR5lG1FI Message-ID: To: Rasmus Lerdorf Cc: Stas Malyshev , Levi Morrison , Clint Priest , "internals@lists.php.net" , "Nikita Popov (nikita.ppv@gmail.com)" Content-Type: multipart/alternative; boundary=047d7b15a91715665f04cc2fb2b3 Subject: Re: [PHP-DEV] [PHP-DEV [RFC] Property Accessors v1.2 : Typehints / Accessor Syntax From: amaury@amaury.net (Amaury Bouchard) --047d7b15a91715665f04cc2fb2b3 Content-Type: text/plain; charset=ISO-8859-1 2012/10/16 Rasmus Lerdorf > The rule in PHP for any sort of type hinting is that it is only done for > non-coercable types. In cases where there is simply no way to recover > from passing the wrong type, it is good to catch it as early as > possible. Extending this to also cover scalar coercable types would be > disastrous for the entire ecosystem and would completely change PHP. My point was not about scalar types. It was about porting the logic of parameters type hinting to object properties. Nothing more, nothing less. And the fact that it is "optional" means absolutely nothing because once > some piece of your system has "optionally" decided to use it you don't > have the option not to abide by it, and it certainly isn't a hint, it is > a strong type. You will end up casting every call to everything all the > time just to be safe. > I use parameters type hinting everyday. I can say it's very useful. And I never needed to cast anything. If the object model is used wisely, and if type hinting is used as an option (i.e. don't use it when you know you'll need "mixed" data), it's a very good thing. I don't see why it couldn't be as good for properties as it is for parameters. But Stas said it was already discussed a lot here, so I give up. :-) --047d7b15a91715665f04cc2fb2b3--