Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:48420 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 7636 invoked from network); 24 May 2010 05:58:52 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 May 2010 05:58:52 -0000 Authentication-Results: pb1.pair.com smtp.mail=adam@adamharvey.name; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=adam@adamharvey.name; sender-id=unknown Received-SPF: error (pb1.pair.com: domain adamharvey.name from 209.85.221.179 cause and error) X-PHP-List-Original-Sender: adam@adamharvey.name X-Host-Fingerprint: 209.85.221.179 mail-qy0-f179.google.com Received: from [209.85.221.179] ([209.85.221.179:42282] helo=mail-qy0-f179.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 51/92-21629-A951AFB4 for ; Mon, 24 May 2010 01:58:52 -0400 Received: by qyk9 with SMTP id 9so4916683qyk.2 for ; Sun, 23 May 2010 22:58:48 -0700 (PDT) Received: by 10.229.184.130 with SMTP id ck2mr960583qcb.119.1274680728263; Sun, 23 May 2010 22:58:48 -0700 (PDT) MIME-Version: 1.0 Sender: adam@adamharvey.name Received: by 10.229.242.13 with HTTP; Sun, 23 May 2010 22:58:28 -0700 (PDT) In-Reply-To: <7.0.1.0.2.20100524075150.16056330@zend.com> References: <7.0.1.0.2.20100522175819.0a601c68@zend.com> <65101.93.108.152.52.1274662417.squirrel@www.geleia.net> <7.0.1.0.2.20100524075150.16056330@zend.com> Date: Mon, 24 May 2010 13:58:28 +0800 X-Google-Sender-Auth: w_Gg2cA_uGwCDvT9OgO4ldP6xRM Message-ID: To: Zeev Suraski Cc: spam@geleia.net, Etienne Kneuss , internals@lists.php.net Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Type hinting From: aharvey@php.net (Adam Harvey) On 24 May 2010 13:09, Zeev Suraski wrote: > I see three key options going forward: > 1. =C2=A0Implement the table along the lines of what it looks like now, p= erhaps > with minor changes. > 2. =C2=A0Implement identical conversion rules to the ones that exist in P= HP; That > effectively turns type hinting into scalar casting operators (not saying > that's a bad thing!) > 3. =C2=A0Implement identical conversion rules to the ones that exist in P= HP, > except for when they really suck. =C2=A0Namely, lose the array->scalar > conversions and silent conversions of non-numeric strings to numbers. Given this is a new feature, my preference is #1, with the addition of the scalar and numeric hints mentioned upthread for less strict checking. I see scalar type hinting as a way of saying "I want a variable of type X", not "I want a variable that may have been lossily coerced into type X"; the developers mentioned in the RFC who are presently unaware of PHP's typing system strike me as being unlikely to use type hinting regardless of how it's implemented. That said, I don't think #3 would be the end of the world, either. My vote is admittedly a little selfish; it just doesn't line up as well as #1 with what I'd actually want to use scalar type hinting for. Adam