Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:34395 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 76587 invoked by uid 1010); 4 Jan 2008 08:09:35 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 76572 invoked from network); 4 Jan 2008 08:09:34 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Jan 2008 08:09:34 -0000 Authentication-Results: pb1.pair.com smtp.mail=tomi@cumulo.fi; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=tomi@cumulo.fi; sender-id=unknown Received-SPF: error (pb1.pair.com: domain cumulo.fi from 81.228.11.120 cause and error) X-PHP-List-Original-Sender: tomi@cumulo.fi X-Host-Fingerprint: 81.228.11.120 pne-smtpout3-sn1.fre.skanova.net Solaris 10 (beta) Received: from [81.228.11.120] ([81.228.11.120:60289] helo=pne-smtpout3-sn1.fre.skanova.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F1/32-20810-CB9ED774 for ; Fri, 04 Jan 2008 03:09:34 -0500 Received: from [192.168.1.3] (84.250.46.16) by pne-smtpout3-sn1.fre.skanova.net (7.3.129) (authenticated as kaisto-9) id 474FCCB000196A8D for internals@lists.php.net; Fri, 4 Jan 2008 09:08:36 +0100 Organization: Cumulo Studio To: internals@lists.php.net Date: Fri, 4 Jan 2008 10:06:53 +0200 User-Agent: KMail/1.9.7 References: <200801031903.01980.tomi@cumulo.fi> <698DE66518E7CA45812BD18E807866CE01103E21@us-ex1.zend.net> In-Reply-To: <698DE66518E7CA45812BD18E807866CE01103E21@us-ex1.zend.net> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-ID: <200801041006.53836.tomi@cumulo.fi> Subject: Re: [PHP-DEV] RE: Optional scalar type hinting From: tomi@cumulo.fi (Tomi Kaistila) > It really doesn't fit in very well with PHP's loosely typed nature which > is one of the main reasons it has been so easy to use. I think this is one of the cornerstones that two sides disagree the most on. People are afraid that PHP would turn into a strong-typed language by allowing type hinting for scalar values. I do not think this would be the case. You would still have all the freedom that you have no with PHP, since PHP's type juggling is still in effect. The only thing that would change is that the validation of the data that is passed into functions would be somewhat automated, but since the validation occurs with or without type hinting the result is still the same. If data is incorrent, an error occurs whether it is an exception, a false return type, or a triggered error. The behaviour of the program does not change with type hinting. > Even this thread shows that there's no alignment between people on what > it should actually do. This is true, but contributed to it is that so far we have spent more time and energy on the silly debate whether or not type hinting is a useful feature. There is enough technical proof to suggest that it is in fact a useful feature. What I would like to see is actual discussion on how it should behave and see if a concensus can be derived. > Saying that it won't confuse newbies is also wrong. PHP is so popular > because it's so easy for people to pick up. Part of this also includes > ability to look at other people's code, understand it, copy-on-write > (e.g. a Wordpress plug-in). This is an argument that I honestly do not understand. Type hinting is already here. It exists in PHP. How can the concept be abandoned on the bases that it would confuse new users, if the concept has already been approved and implemented? Tomi Kaistila PHP Developer