Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:34424 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 48721 invoked by uid 1010); 4 Jan 2008 17:44:41 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 48705 invoked from network); 4 Jan 2008 17:44:41 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Jan 2008 17:44:41 -0000 Authentication-Results: pb1.pair.com smtp.mail=mls@pooteeweet.org; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=mls@pooteeweet.org; sender-id=unknown Received-SPF: error (pb1.pair.com: domain pooteeweet.org from 85.10.196.195 cause and error) X-PHP-List-Original-Sender: mls@pooteeweet.org X-Host-Fingerprint: 85.10.196.195 serveforce1.backendmedia.com Linux 2.6 Received: from [85.10.196.195] ([85.10.196.195:35710] helo=serveforce1.backendmedia.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B5/DE-63281-8807E774 for ; Fri, 04 Jan 2008 12:44:41 -0500 Received: from [192.168.0.151] (77-57-23-243.dclient.hispeed.ch [77.57.23.243]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (Client did not present a certificate) by serveforce1.backendmedia.com (Postfix) with ESMTP id CE5A61224C99; Fri, 4 Jan 2008 18:46:51 +0100 (CET) Cc: Pierre , Marcus Boerger , Gregory Beaver , Alain Williams , internals Mailing List Message-ID: <232B1227-ECF4-4AC6-89C5-6179478A51DF@pooteeweet.org> To: Robert Cummings In-Reply-To: <1199468241.6629.53.camel@blobule> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v915) Date: Fri, 4 Jan 2008 18:44:29 +0100 References: <477DB7BF.10201@chiaraquartet.net> <20080104105558.GC7861@mint.phcomp.co.uk> <477E5649.2080104@chiaraquartet.net> <1463438959.20080104182050@marcus-boerger.de> <1199468241.6629.53.camel@blobule> X-Mailer: Apple Mail (2.915) X-backendmedia-com-MailScanner-Information: Please contact the ISP for more information X-backendmedia-com-MailScanner: Found to be clean X-backendmedia-com-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=0.134, required 6, AWL 0.03, RDNS_DYNAMIC 0.10) X-backendmedia-com-MailScanner-From: mls@pooteeweet.org X-Spam-Status: No Subject: Re: [PHP-DEV] type hinting From: mls@pooteeweet.org (Lukas Kahwe Smith) On Jan 4, 2008, at 6:37 PM, Robert Cummings wrote: > On Fri, 2008-01-04 at 18:23 +0100, Pierre wrote: >> On Jan 4, 2008 6:20 PM, Marcus Boerger wrote: >>> Hello Pierre, >>> >>> we never accepted this as a pro argument. Infact we often saw the >>> necessaity to highlight something is optional to vote against it. >>> We do this >>> for a reason. That is we only want to support mainstream features. >> >> My point of view is that this feature should be a mainstream feature. >> To make it optional was to lower the issues for those who don't care >> about argument strictness. We did not give them this choice for the >> OO >> strictness. > > IMHO, optionally inclusion of type hinting for functions/methods can > only be a boon to code quality and readability. IMHO when a type > hint is > provided and a parameter doesn't match the type hint then I think a > fatal error should occur. This forces the user of the function that > has > type hinting to ensure their data is of the correct type. This > prevents > accidental wrong data conversion. However, I see the other side of the > coin too where automatic type conversion could be desirable also. Fatal error is a no no. This goes back to my argument of why exceptions do not fit the PHP development process as uncaught exceptions are also fatal errors. The reason is that PHP is great because it works as good as is reomotely possible with the given code. Look at SugarCRM, the code is horrific, yet it works (more or less). This is especially a concern for me when doing refactoring types are surely going to mismatch during the process, but as I test some parts of my changes, I do not want the entire application to fail until I complete my refactoring. Fatal errors everywhere are a nice way to beat developers to write finished code from day one (or actually before any refresh), which matches the development style how exactly how many PHP developers? But we are only talking about an E_RECOVERABLE. That being said the argument brought up by Greg about the lack of context still applies so maybe it should just be a warning or whatever .. regards, Lukas