Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:75389 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 16991 invoked from network); 13 Jul 2014 11:35:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Jul 2014 11:35:49 -0000 Authentication-Results: pb1.pair.com smtp.mail=zeev@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=zeev@zend.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 209.85.220.173 as permitted sender) X-PHP-List-Original-Sender: zeev@zend.com X-Host-Fingerprint: 209.85.220.173 mail-vc0-f173.google.com Received: from [209.85.220.173] ([209.85.220.173:47396] helo=mail-vc0-f173.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 21/00-16748-31F62C35 for ; Sun, 13 Jul 2014 07:35:48 -0400 Received: by mail-vc0-f173.google.com with SMTP id hy10so1488723vcb.32 for ; Sun, 13 Jul 2014 04:35:44 -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=MKBBGC8OyebGXq/wIkFYmCtLbEEPgwN9yU7h/3Dh5OU=; b=gwH9BGPKQv6xDiCveWhFd7aThBFvLLMTzatf5pf+UL8xbsmXbpekWGqTf7WAp0bB9q pyiPCG/KHUuugNVniS8K5iiIaY5HNttiFfcnWbnlFqVUN2hkEk05epg5IicmVocxc9aO oPwM03PvjxfjFCytpdJX0x4cMv2+BU+GaEo2tKXZVz2w8SLBv+1MxAt2zRa6movvpnSk Vpnw5jsLa0cjptOG7KFwedTYQ//NkcMBZHn/6n9ss2JYgJJqvMn40+MG38r4kfiOGUJp 2p85V32TkcIN8T6+GtZ/nUovKGnAoUXaM7mfYCaEEM/tnaS0U+Q4h4a7wl40AIcRLR8o xujg== X-Gm-Message-State: ALoCoQlLjJXTm3JLzPNUzgi6ZQzbXHzK8IVT8Lde7DHRvvF47b7IBL5sTL0qbjQZOoOuuKzknCRgYeFEcVyVJHnp/l5Fv7/f0NPRBdZ/GV/g4czaAOxnmVXgUt/urqwzmVbmp2chrtR3 X-Received: by 10.220.17.199 with SMTP id t7mr10318073vca.1.1405251344377; Sun, 13 Jul 2014 04:35:44 -0700 (PDT) References: <08503591-EFC8-48E6-984E-FFC292C5EA5F@ajf.me> <53C2178E.7070705@sugarcrm.com> <53C24061.6050503@lsces.co.uk> <20140713101840.GR6540@phcomp.co.uk> In-Reply-To: <20140713101840.GR6540@phcomp.co.uk> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQJuUFVOlGiX172RfpkkW7aXwqSXwwKNH6ZhAjN2Q/kB5Eycs5orROhQ Date: Sun, 13 Jul 2014 14:35:43 +0300 Message-ID: <2f218b4d8cffb1a55e464e715c319b1f@mail.gmail.com> To: Alain Williams , Lester Caine Cc: internals@lists.php.net 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) > I don't see the current PHP type juggling as 'formal programming'. It makes > things easy but can also lead to bugs where unexpected values (& so types) > end up being inappropriately used. I haven't yet reviewed the conversion table in detail, but unless I'm missing something, this RFC is in fact much more in the spirit of PHP - and implements type juggling - unlike the previous incarnation of strict typing that almost made it into PHP. It's a bit too strict to my liking (especially around conversion of floating point to int, which should pass and perhaps generate a notice IMHO), but this is a big step towards the spirit of what I proposed together with Lukas back in 2010 (https://wiki.php.net/rfc/typecheckingstrictandweak) - which was an alternative to the strong typing suggested by several others. Type juggling is an *inherent* feature of PHP. Paraphrasing what Rasmus said several years ago(*), 'if you implement this [strong typing], please don't call it PHP'. Again, luckily, what Andrea proposes isn't strong typing. It still maintains the most important properties of type juggling - e.g. the ability to work with strings coming in as input (GET/POST/etc.) without having to worry about typing. Zeev (*) I couldn't find that email quickly enough so apologies if I'm not completely accurate on this.