Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:58587 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 47894 invoked from network); 4 Mar 2012 17:17:22 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Mar 2012 17:17:22 -0000 Authentication-Results: pb1.pair.com smtp.mail=ircmaxell@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ircmaxell@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.42 as permitted sender) X-PHP-List-Original-Sender: ircmaxell@gmail.com X-Host-Fingerprint: 209.85.216.42 mail-qw0-f42.google.com Received: from [209.85.216.42] ([209.85.216.42:41217] helo=mail-qw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A9/E7-12048-0A3A35F4 for ; Sun, 04 Mar 2012 12:17:21 -0500 Received: by qaui11 with SMTP id i11so431082qau.8 for ; Sun, 04 Mar 2012 09:17:18 -0800 (PST) Received-SPF: pass (google.com: domain of ircmaxell@gmail.com designates 10.229.76.149 as permitted sender) client-ip=10.229.76.149; Authentication-Results: mr.google.com; spf=pass (google.com: domain of ircmaxell@gmail.com designates 10.229.76.149 as permitted sender) smtp.mail=ircmaxell@gmail.com; dkim=pass header.i=ircmaxell@gmail.com Received: from mr.google.com ([10.229.76.149]) by 10.229.76.149 with SMTP id c21mr2209518qck.5.1330881438150 (num_hops = 1); Sun, 04 Mar 2012 09:17:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=9XWlkJIEzQE9nZ0oLo6+sIJjUOrnDKHLcKhB3D87Rw0=; b=lBwMva4mSM2db0gJqoDdxu77ukbGMof6kqM2BB0flgNOjD7Qh073ATraXqXCXlSkON 8hZ3UueAn4ilWrk0j+pkElSPG5H8Buyj7RUzYlX727z8dKpWcKiqdEokQjTtSCw6JBYd i192Pn6u9gf/aeYkGde0VyfQY4iAKUbkhLyHJRDVlXSc5RPuYNXiAoYNyAnljUlecS47 LJ1n5ZjiqyjsMZ0t2PriKXIwqsRfpbF7drCyyo150pvBROOhmvx72irT0QkxAxKVmQJa CuPp+hjMVrxuajZTJ9ethqzzbE5TVL0umb7UNBdbIIsvY+t/aB9gru4AeNres1YgmJSa a5BA== MIME-Version: 1.0 Received: by 10.229.76.149 with SMTP id c21mr1890012qck.5.1330881438011; Sun, 04 Mar 2012 09:17:18 -0800 (PST) Received: by 10.229.49.74 with HTTP; Sun, 4 Mar 2012 09:17:17 -0800 (PST) Received: by 10.229.49.74 with HTTP; Sun, 4 Mar 2012 09:17:17 -0800 (PST) In-Reply-To: References: Date: Sun, 4 Mar 2012 12:17:17 -0500 Message-ID: To: Lazare Inepologlou Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary=00235429e34c59d28704ba6dfbf3 Subject: Re: [PHP-DEV] [RFC - Discussion] Parameter Type Casting Hints From: ircmaxell@gmail.com (Anthony Ferrara) --00235429e34c59d28704ba6dfbf3 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On Mar 4, 2012 11:47 AM, "Lazare Inepologlou" wrote: > > > Anthony, just a tiny detail in your RCF: > >> So (int) $foo =3D null and (int) $foo =3D 1 are both supported, but (int= ) $foo =3D =931=94 will generate an E_COMPILE_ERROR. > > > If null is going to be cast, (int)null is 0. So I don't think it should be a valid default value. Well, there were two reasons that I added null: first, for consistency with the existing type hints. Second, and more importantly, to allow checking if a parameter is specified. So without null, you couldn't tell the difference between an explicit 0 and an implicit (not specified) 0. This way, you can. I admit the use cases for that are rather slim, but a good portion of internal functions behave this way (substr comes to mind)... I think it is worth discussing further, as your point is indeed valid... > > Lazare INEPOLOGLOU > Ing=E9nieur Logiciel > > > 2012/3/4 Anthony Ferrara >> >> Hey all, >> >> I've drafted an RFC for the Parameter type casting hint proposal that >> I posted to before. Attached to the RFC is a patch that's proposed >> for inclusion in core for functionality (it doesn't include news >> entries, or documentation, or any of the other steps that would be >> needed prior to commit). >> >> https://wiki.php.net/rfc/parameter_type_casting_hints >> >> Please provide feedback here on the implementation and RFC topics. >> >> Thanks, >> >> Anthony >> >> -- >> PHP Internals - PHP Runtime Development Mailing List >> To unsubscribe, visit: http://www.php.net/unsub.php >> > On Mar 4, 2012 11:47 AM, "Lazare Inepologlou" wrote: > > Anthony, just a tiny detail in your RCF: > > So (int) $foo =3D null and (int) $foo =3D 1 are both supported, but (int)= $foo >> =3D =931=94 will generate an E_COMPILE_ERROR. >> > > If null is going to be cast, (int)null is 0. So I don't think it should b= e > a valid default value. > > > Lazare INEPOLOGLOU > Ing=E9nieur Logiciel > > > 2012/3/4 Anthony Ferrara > >> Hey all, >> >> I've drafted an RFC for the Parameter type casting hint proposal that >> I posted to before. Attached to the RFC is a patch that's proposed >> for inclusion in core for functionality (it doesn't include news >> entries, or documentation, or any of the other steps that would be >> needed prior to commit). >> >> https://wiki.php.net/rfc/parameter_type_casting_hints >> >> Please provide feedback here on the implementation and RFC topics. >> >> Thanks, >> >> Anthony >> >> -- >> PHP Internals - PHP Runtime Development Mailing List >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> > --00235429e34c59d28704ba6dfbf3--