Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:57032 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 69410 invoked from network); 22 Dec 2011 20:14:35 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Dec 2011 20:14:35 -0000 Authentication-Results: pb1.pair.com smtp.mail=will.fitch@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=will.fitch@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.170 as permitted sender) X-PHP-List-Original-Sender: will.fitch@gmail.com X-Host-Fingerprint: 209.85.216.170 mail-qy0-f170.google.com Received: from [209.85.216.170] ([209.85.216.170:61616] helo=mail-qy0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id EA/D2-12618-BAF83FE4 for ; Thu, 22 Dec 2011 15:14:35 -0500 Received: by qcsd16 with SMTP id d16so5583527qcs.29 for ; Thu, 22 Dec 2011 12:14:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to:x-mailer; bh=ANrUoDpxLORmYeEXhI9cVPYatq5hkKda/j/i+3ahP9o=; b=IkdDVUXM9kB+IqS+0s1cWTL2SEdLHn5Pv7DAxDglwCmPYar0hw1RyX+L0GZuABucQl gBiaQvU5nfu5dsgjvI1qiLI/5phQvzuNhHtQhBVpYgfo24uHE2ZLLAsq/D7n3v7rdJg4 EzC6+KiS27XezxKr0NUVAXywTVgiHYR5FkscU= Received: by 10.229.77.132 with SMTP id g4mr4750383qck.65.1324584871939; Thu, 22 Dec 2011 12:14:31 -0800 (PST) Received: from [192.168.1.68] ([68.64.144.221]) by mx.google.com with ESMTPS id i10sm19238105qac.17.2011.12.22.12.14.28 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 22 Dec 2011 12:14:30 -0800 (PST) Mime-Version: 1.0 (Apple Message framework v1251.1) Content-Type: text/plain; charset=iso-8859-1 In-Reply-To: <4EF38DBA.2030808@sugarcrm.com> Date: Thu, 22 Dec 2011 15:14:28 -0500 Cc: Anthony Ferrara , Dmitri Snytkine , Sebastian Bergmann , "internals@lists.php.net" Content-Transfer-Encoding: quoted-printable Message-ID: <5BCF1CA0-6E0D-41B0-8EAC-4EFE9325B08A@gmail.com> References: <2095305E-D4E3-4D7E-8218-32EE99688E0C@GMAIL.COM> <2C90FB94-38C4-4270-8C6A-B89304BA8ED8@gmail.com> <159A7CA2-8561-40DA-9434-CAAE12304DDB@gmail.com> <005701ccc0b3$58c8dee0$0a5a9ca0$@alliantinternet.com> <20111222145159.GY25857@alliantinternet.com> <006101ccc0ba$46b81160$d4283420$@alliantinternet.com> <4EF379D8.9000206@lerdorf.com> <4EF37C29.1010206@php.net> <4EF37D19.8080207@alliantinternet.com> <007e01ccc0dc$985f1cd0$c91d5670$@alliantinternet.com> <4EF38297.5040507@alliantinternet.com> <008001ccc0df$3c8faa70$b5aeff50$@alliantinternet.com> <4EF38573.6060305@sugarcrm.com> <4EF38DBA.2030808@sugarcrm.com> To: Stas Malyshev X-Mailer: Apple Mail (2.1251.1) Subject: Re: [PHP-DEV] Return Type Hinting for Methods RFC From: will.fitch@gmail.com (Will Fitch) On Dec 22, 2011, at 3:06 PM, Stas Malyshev wrote: > Hi! >=20 >> I'm going to have to disagree with you there. Type hinting DOES save >> me a LOT of effort in development. I can stop worrying about = checking >> to make sure the parameter that I got is what I want it to be, and >> just use it. The runtime will check and enforce that for me. When >=20 > I'm sorry but I don't see how what you describe is good. You stopped = worrying about checking inside the function, but unless you have started = checking outside the function you've just made your code less robust = that it was before. While in the case of strict class typing the case of = mismatched classes is so rare that occasional failure is easily = identifiable, you didn't really improve your code. I agree that it makes = you type less - but the cost of it is your application also does less - = you don't have a capability of gracefully handling a problem any longer. = Again, with object strict typing, this might be OK since failures are = very rare and usually a result of obvious mistakes caught early in = testing - but if they are not, you didn't really gain much. I wouldn't be opposed to moving from raising an E_RECOVERABLE_ERROR to = some type of exception. In fact, I'd support it (in a discussion over = that RFC). Your argument of not checkout outside the function is = exactly why many are against type hinting scalars to begin with. A = generic "scalar" keyword being added would help some, but only protect = against objects, resources and arrays. > --=20 > Stanislav Malyshev, Software Architect > SugarCRM: http://www.sugarcrm.com/ > (408)454-6900 ext. 227 >=20 > --=20 > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php >=20