Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:80101 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 88345 invoked from network); 2 Jan 2015 16:35:54 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Jan 2015 16:35:54 -0000 Authentication-Results: pb1.pair.com header.from=leverton@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=leverton@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.192.182 as permitted sender) X-PHP-List-Original-Sender: leverton@gmail.com X-Host-Fingerprint: 209.85.192.182 mail-pd0-f182.google.com Received: from [209.85.192.182] ([209.85.192.182:43518] helo=mail-pd0-f182.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C2/00-22504-9E8C6A45 for ; Fri, 02 Jan 2015 11:35:54 -0500 Received: by mail-pd0-f182.google.com with SMTP id p10so23899839pdj.13 for ; Fri, 02 Jan 2015 08:35:51 -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=uuTwsOvA6tBDasFb/BJqQg4bKGnWJ9b0LIHWrKfwMGk=; b=dCMbjKYE/f1I420/Q5nmldpeHd2e0o5DuJAjeo7zAueogoev571KbuGezjmTb9j+ju dZjXWIfYcUPqXfxWkVlQmxkyJYgm0KUIVCCaCHVrkaVfjCrdGXdjC63+TYsy4c7A+PtP pscPzU18p9vuqY66HRd3hhA0udf+3Ba/njykvc3bTpAd6wi6aSxRJfvv3XOLNk63t6GR ysmog4DBp7XIBw8gNjLjgbIcooOuFdPQvEc53YwoGik074huNX6dKmS37tOhhwXkbkUY kWpU6y738nZ0n0kNeqxggkEouipjR4GIRq/iEr63Nr9jTehHZ+zEf1PvZ9v1M8FgtwgG xUYg== MIME-Version: 1.0 X-Received: by 10.70.47.129 with SMTP id d1mr123812088pdn.46.1420216550978; Fri, 02 Jan 2015 08:35:50 -0800 (PST) Received: by 10.70.16.36 with HTTP; Fri, 2 Jan 2015 08:35:50 -0800 (PST) In-Reply-To: <41D5BB0B-73AF-488E-968D-90B2878E3178@ajf.me> References: <41D5BB0B-73AF-488E-968D-90B2878E3178@ajf.me> Date: Fri, 2 Jan 2015 10:35:50 -0600 Message-ID: To: Andrea Faulds Cc: PHP Internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] [RFC] Scalar Type Hints From: leverton@gmail.com (Matthew Leverton) On Wed, Dec 31, 2014 at 2:27 PM, Andrea Faulds wrote: > > Please read the RFC (and specification patch, if you wish) and tell me your thoughts. > My thoughts as a long time (non-voting) PHP user: I'd much prefer if they were strict types. I have a bias toward this because I prefer to be as strict as possible. It's not hard to type my_func((int) $_GET['foo']) if I want easy conversion. This explicit cast serves as a reminder that I'm being sloppy. I can quickly scan and see if there are parts of my code that are more prone to bugs. But I'm not opposed to the RFC. I think it's *way* better than nothing, and I understand the arguments in its favor. My one complaint: I don't like that it emits a notice. I treat notices as broken code, and if it's proper to say (int) "7 things", then it ought to be proper to send that into a function. With notices being a possibility, I'll need to manually add (int) in front of everything ... at which point, we might as well have strict types. (Off-topic and different RFC, but I think having return types that auto-cast is weird, which is another reason I'd prefer strict types all around.) Finally, I'm not sure that implementing both (strict / type juggling) with different syntax is a good idea. I think I'd prefer one or the other. I don't really want to keep track as a user of many composer libs (etc) which authors decided I need to use strict types. Because I wouldn't want to have two different styles of code depending on the library I'm using, I'd end up again going back to assuming everything was a strict type. -- Matthew Leverton