Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:58407 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 16465 invoked from network); 1 Mar 2012 10:59:47 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Mar 2012 10:59:47 -0000 Authentication-Results: pb1.pair.com header.from=julienpauli@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=julienpauli@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.170 as permitted sender) X-PHP-List-Original-Sender: julienpauli@gmail.com X-Host-Fingerprint: 209.85.215.170 mail-ey0-f170.google.com Received: from [209.85.215.170] ([209.85.215.170:54005] helo=mail-ey0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F0/82-46815-2A65F4F4 for ; Thu, 01 Mar 2012 05:59:47 -0500 Received: by eaao10 with SMTP id o10so129380eaa.29 for ; Thu, 01 Mar 2012 02:59:44 -0800 (PST) Received-SPF: pass (google.com: domain of julienpauli@gmail.com designates 10.14.95.202 as permitted sender) client-ip=10.14.95.202; Authentication-Results: mr.google.com; spf=pass (google.com: domain of julienpauli@gmail.com designates 10.14.95.202 as permitted sender) smtp.mail=julienpauli@gmail.com; dkim=pass header.i=julienpauli@gmail.com Received: from mr.google.com ([10.14.95.202]) by 10.14.95.202 with SMTP id p50mr2684766eef.78.1330599584393 (num_hops = 1); Thu, 01 Mar 2012 02:59:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; bh=rXZMTZC9UYWnUH5o6Bq+XUz8ym2NfjbkzFbV1ys9gEQ=; b=MMkDE9QkB0ffAUkwYo5McSW11gc0QqwiFyaMS3zNA3P8ZcnQDgpu92RQ4NpBPorB+x PPo1VmhBsIrUbVAxswlEbSGH76G0YkyCF026J2tng2Er6nEn9JQBowiCQomLf8caEDq8 9/4AToDc8eyXXlmQk2XMeZmiwk0I2Jn+dsKSI= Received: by 10.14.95.202 with SMTP id p50mr2068097eef.78.1330599584285; Thu, 01 Mar 2012 02:59:44 -0800 (PST) MIME-Version: 1.0 Sender: julienpauli@gmail.com Received: by 10.213.29.2 with HTTP; Thu, 1 Mar 2012 02:59:04 -0800 (PST) In-Reply-To: References: <693e15008681dfe7372eaea66214f8a8.squirrel@www.l-i-e.com> <4F4D5D44.5090307@developersdesk.com> Date: Thu, 1 Mar 2012 11:59:04 +0100 X-Google-Sender-Auth: jchfRZrE7fHygpYFEHdq1ma5lMQ Message-ID: To: Simon Schick Cc: John Crenshaw , Richard Lynch , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=bcaec52be6b38f437c04ba2c5bc5 Subject: Re: [PHP-DEV] PHP Philosophy (was RE: [PHP-DEV] Scalar type hinting) From: jpauli@php.net (jpauli) --bcaec52be6b38f437c04ba2c5bc5 Content-Type: text/plain; charset=ISO-8859-1 On Thu, Mar 1, 2012 at 9:52 AM, Simon Schick wrote: > Hi, John > > Just to add an idea to yours .. > > Do you think it's a compatibility-break if we'd decide to send a E_NOTICE > or E_WARNING if we f.e. try to give a string to a method that just allows > integer for this argument? > No break at all, just a E_NOTICE or E_WARNING as the script can succeed > anyways. > > Perhaps I missed something, but since 5.3, the new parameter parsing API throws a Warning when types are not strictly honored. This has been a major feature in favor of "cleaner" programming. Try substr('foo', 'bar'), in PHP >= 5.3 and you get a warning and the function returns null. Julien.P > Bye > Simon > > 2012/3/1 John Crenshaw > > > > From: Richard Lynch [mailto:ceo@l-i-e.com] > > > On Wed, February 29, 2012 7:16 pm, John Crenshaw wrote: > > > > I'm beginning to think that the type hinting question is too closely > > > > related to the dirty secrets of type juggling to resolve them > > > > separately. You may have to either discard consistency, or else fix > > > > the problem of silent bizarre conversions at the same time ('foo'==0, > > > > '123abc'=123). Fixing the conversions is a BC break though. > > > > > > [short version] > > > One man's "fixing" is another man's "feature" :-) > > > > > > Old hands can now hit delete while I wax philosophical. > > > > The operative word was "silent". The actual behavior is fine, but the > > silence is unexpected. For example, PHP happily accepts substr('foo', > > 'bar') with no complaint at all. From a purely philosophical perspective > I > > think almost everyone would expect *at least* a strict notice. > > > > On a practical level, we have a major barrier and we'll have to decide > how > > to handle it. As I see it we could do one of the following: > > 1. Discard consistency (!!) > > 2. Try to convince people to make these bizarre conversions not silent > (BC > > break) > > 3. Try to find a creative solution to be consistent without changing > > anything about the conversion behavior. (I'm not seeing a way to do this > > one, unless we redefine "consistent".) > > > > John Crenshaw > > Priacta, Inc. > > > > -- > > PHP Internals - PHP Runtime Development Mailing List > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > --bcaec52be6b38f437c04ba2c5bc5--