Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:76003 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 75774 invoked from network); 24 Jul 2014 10:25:42 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Jul 2014 10:25:42 -0000 Authentication-Results: pb1.pair.com header.from=zeev@zend.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=zeev@zend.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 209.85.220.179 as permitted sender) X-PHP-List-Original-Sender: zeev@zend.com X-Host-Fingerprint: 209.85.220.179 mail-vc0-f179.google.com Received: from [209.85.220.179] ([209.85.220.179:62483] helo=mail-vc0-f179.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3D/F2-58899-52FD0D35 for ; Thu, 24 Jul 2014 06:25:42 -0400 Received: by mail-vc0-f179.google.com with SMTP id hq11so4493143vcb.38 for ; Thu, 24 Jul 2014 03:25:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:references:in-reply-to:mime-version :thread-index:date:message-id:subject:to:cc:content-type; bh=/8WGTSYYHAyXekE79d4a8JQv+gm5QZqzoJrR+2gfVfM=; b=aajkBU3b2HCr7lrNjKjpvifVibLzwVj6pv/3YMM87yZzIqA2Bly5MXyHqxRJhWIOGL iF+Nj/S5Q9Dum2MjPj3r79OrUpPyQ35D3OIVf8TP5yH5G8soWpxYSJaCOOCgNp4xAiAP XFf/UnV3fHt3ic/qK214zDOgRXVQG2FYd4m7z2n/lDTiIJHTAY5UveNn8wUOeCofLfv4 DVS+HNmjiT98m5y4SIAylWt62bV3W05PrlcZHS2GNA0pNkRMKvtlY8Tcr6iJrwJmXouh VPw+lfryBxyjOj9KHfavqSZT9GFfabgGR7c20kd/HhE+BYppRL/JHU3sXxRPap5i+yae QX4A== X-Gm-Message-State: ALoCoQkwuzJUeSzi62oOuDHGqzpfuY/zO4I0kJWzZiMpKHVYvbB9SU4jRaACyBlV0mVWw09xum+GiujJVB83ksyE88lJyGgEINKukj1SJlOOyBINJq4vf+nu5H5dT0fXpM3NzEDMQiTX X-Received: by 10.52.34.46 with SMTP id w14mr8648982vdi.64.1406197543375; Thu, 24 Jul 2014 03:25:43 -0700 (PDT) References: <08503591-EFC8-48E6-984E-FFC292C5EA5F@ajf.me> <12448510.rPWIJSKt4t@rofl> <53D0CBE2.5010200@sugarcrm.com> In-Reply-To: <53D0CBE2.5010200@sugarcrm.com> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQJuUFVOlGiX172RfpkkW7aXwqSXwwFk+rVEAfkAhK4B0r0g6QJWNVT+mjV3E9A= Date: Thu, 24 Jul 2014 13:25:42 +0300 Message-ID: <33bf22776118d2b4ddafee7014a826b2@mail.gmail.com> To: Stas Malyshev Cc: PHP internals Content-Type: text/plain; charset=UTF-8 Subject: RE: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening) From: zeev@zend.com (Zeev Suraski) > -----Original Message----- > From: Stas Malyshev [mailto:smalyshev@sugarcrm.com] > Sent: Thursday, July 24, 2014 12:04 PM > To: Pierre Joye > Cc: PHP internals > Subject: Re: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening) > > That's called strict typing and was discussed many times. Do we really > want > another round of repeating the same arguments? We definitely do not.. To elaborate, the notion that we already have strict class types for classes, so we should have the same thing for scalar makes no sense at all. Here's why: 1. If it was the case, we'd add this right when we added class type hints (strict class types). 2. The fact of the matter is that we did not. Why not? Because scalars in PHP behave in an inherently different way. 3. As I stated already, 'Dynamic Typing defines PHP, class type hints do not'. Class type hints were added at a *MUCH* later stage, as a part of the major rollout of the new object model of PHP 5. It was actually agreed that the *only* way we'd add such type hints is if we weren't going to have them for scalar types. What we have on the table right now - casting type hints - can be made to behave in a way that's consistent with the dynamic typing nature of PHP. My main concern about the RFC the way it stands right now is that the current direction involves E_RECOVERABLE_ERROR instead of E_STRICT or E_CAST for data loss. This results in both consistency issues with casting as well as incompatibility with the dynamic nature of PHP scalars. I know the RFC author (Andrea) disagrees with me about it, but I think we need to find a way to put this into a much wider decision. Probably the most practical thing to do is to put it as a secondary question in the RFC, although those can be tricky. Zeev