Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:52080 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 35267 invoked from network); 29 Apr 2011 05:05:06 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Apr 2011 05:05:06 -0000 Authentication-Results: pb1.pair.com smtp.mail=smalyshev@sugarcrm.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=smalyshev@sugarcrm.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain sugarcrm.com designates 67.192.241.193 as permitted sender) X-PHP-List-Original-Sender: smalyshev@sugarcrm.com X-Host-Fingerprint: 67.192.241.193 smtp193.dfw.emailsrvr.com Linux 2.6 Received: from [67.192.241.193] ([67.192.241.193:48344] helo=smtp193.dfw.emailsrvr.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 05/F0-29189-1074ABD4 for ; Fri, 29 Apr 2011 01:05:06 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp9.relay.dfw1a.emailsrvr.com (SMTP Server) with ESMTP id F2DBA3C0326 for ; Fri, 29 Apr 2011 01:05:02 -0400 (EDT) X-Virus-Scanned: OK Received: by smtp9.relay.dfw1a.emailsrvr.com (Authenticated sender: smalyshev-AT-sugarcrm.com) with ESMTPSA id 93BF03C031F for ; Fri, 29 Apr 2011 01:05:02 -0400 (EDT) Message-ID: <4DBA46FD.5090106@sugarcrm.com> Date: Thu, 28 Apr 2011 22:05:01 -0700 Organization: SugarCRM User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 MIME-Version: 1.0 To: internals References: <4DB923E6.3020307@sugarcrm.com> <4DB9A7BE.6010307@sugarcrm.com> <20110428181630.GA8496@phcomp.co.uk> In-Reply-To: <20110428181630.GA8496@phcomp.co.uk> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC] Return type-hint From: smalyshev@sugarcrm.com (Stas Malyshev) Hi! > I will accept that sometimes it must always be done run time, eg: > > $funcName($arg) > > but that still allows most calls at compile time. This is not the issue. This is the issue: $foo->bar($arg). There's no way to resolve it in "compile time", whatever that means, without having a type on $foo. > Anyway - the check for return type would be done in the called function, > not the calling function. That's the point. You don't get any extra safety on the caller's side, because you don't actually know much about the called function. With checking arguments, it makes more sense as you are serving the called function - so you know the code that ensures types and the code that relies on this assurance is together and can rely on each other. There are other problems with it, but not this one at least. Here you have the assurance on one side and the code that relies on it on the other. > Which might be acceptable for some applications. For those where it is not > then this feature may not be useful. This is an *optional* declaration, > not mandatory - so if it does not suit your purpose -- don't use it. You are talking about pretty big change in language nature - introducing strict typing. "It's just option, don't use it if you don't want" doesn't really sound good in this case. If it's in the language, it should make sense and sit well with the rest of the language. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227