Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:83017 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 3104 invoked from network); 18 Feb 2015 01:05:53 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Feb 2015 01:05:53 -0000 Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.173 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 74.125.82.173 mail-we0-f173.google.com Received: from [74.125.82.173] ([74.125.82.173:36000] helo=mail-we0-f173.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F3/37-34644-075E3E45 for ; Tue, 17 Feb 2015 20:05:53 -0500 Received: by wevk48 with SMTP id k48so1756369wev.3 for ; Tue, 17 Feb 2015 17:05:50 -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=jSAQLmW1P8QrvDFCitH8S6jnQ3+48xbJADWTYgGW21k=; b=MWHRkka+Psh8UWkI6uF6UxSvhtUiV+uZsxk5GvVuOu2l19F/XIrmaH1Gnr40RaZOOm IyZ8T1z1xnLDaThd1Pwj5tHXvKDm8ZRFmqBDR3DvNo/rsFBVvZB91dDTsqtwsBzNXPUf Z/ZONhRvZrDBdpzOzA+MHGWEB6HILaOX8SAhawVdjfCYcFpd8QOQ6CpJIBLGGE1ffkuz nKO1u4mxYGXgeUNKbDlSqj4R4+EWFCd5+130PxLGJ1ev7DE2hlAgVNx8CI6LDuy58/jt pF0TTgLk+hXHfrk4x6O18Y9RGoGA9Dq2uBvYvzuBUTEPrq5VSsAzLQ8uQzuJ0BU4LwNf 3drg== MIME-Version: 1.0 X-Received: by 10.180.198.240 with SMTP id jf16mr63071088wic.27.1424221549737; Tue, 17 Feb 2015 17:05:49 -0800 (PST) Received: by 10.27.10.168 with HTTP; Tue, 17 Feb 2015 17:05:49 -0800 (PST) In-Reply-To: <54E3E27B.2010903@lerdorf.com> References: <54E3E27B.2010903@lerdorf.com> Date: Wed, 18 Feb 2015 02:05:49 +0100 Message-ID: To: Rasmus Lerdorf Cc: Sara Golemon , PHP internals Content-Type: multipart/alternative; boundary=047d7b66f6db8dbaef050f526b07 Subject: Re: [PHP-DEV] Scalar Type Hints v0.4 From: nikita.ppv@gmail.com (Nikita Popov) --047d7b66f6db8dbaef050f526b07 Content-Type: text/plain; charset=UTF-8 On Wed, Feb 18, 2015 at 1:53 AM, Rasmus Lerdorf wrote: > On 02/17/2015 04:35 PM, Nikita Popov wrote: > > I don't buy into Rasmus arguments about internal functions. They concern > > one particular edge case (int->float coercion) and I doubt they have much > > relevance if applied to codebases with pervasive use of typehints (where > > you can be reasonably sure of the types of your variables). Even if, for > > the sake of argument, we acknowledge the concern as valid we should be > > discussing that particular case (int->float coercion) rather than > dropping > > the strict typing for internal functions altogether. > > int->float is actually secondary to "123"->int. And while they may be > edge-cases there are enough of them that we would be pushing people > towards casting by default which should be a last-resort thing, not the > first thing you do. > The inability to implicitly cast "123" to int is pretty much the KEY distinction between weak and strict scalar typehints (those pesky value-dependent type checks). If the strict typing mode doesn't offer this, what's the point at all? This is exactly what I fear will happen with an arginfo based approach. If even fundamental aspects like the "123" vs 123 (or true vs 1) distinction are suppressed for internal functions, this isn't a strict typing mode, it's just a weak typing mode with slightly different rules. Nikita --047d7b66f6db8dbaef050f526b07--