Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:84551 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 51922 invoked from network); 11 Mar 2015 15:53:01 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Mar 2015 15:53:01 -0000 Authentication-Results: pb1.pair.com header.from=danack@basereality.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=danack@basereality.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain basereality.com from 209.85.160.180 cause and error) X-PHP-List-Original-Sender: danack@basereality.com X-Host-Fingerprint: 209.85.160.180 mail-yk0-f180.google.com Received: from [209.85.160.180] ([209.85.160.180:40123] helo=mail-yk0-f180.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 72/B7-07702-AD460055 for ; Wed, 11 Mar 2015 10:53:01 -0500 Received: by ykq142 with SMTP id 142so4416108ykq.7 for ; Wed, 11 Mar 2015 08:52:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=kbqrWGOpSFcEjBi/m26JtWWpFMbHOAG4GBHn85cbMZA=; b=DTzWlQ72z0+nSP/iqAmpdYtZM4ZRP3b93Kl5xOQ3waLjh/Ag+MUQ0oEpXE7lS1UMLi hFJSmQ1HItblsXFH02KZP78s02kILQLusSWxRwoNTVQQN8cjUQoEJOz8zSIHYE7v/VKL gAnA0jAcP/twZnGAb3dzUuw1+SPKWsFTjxZmQiopVs0AhyyOB1qzsN6gPvp9Y/Zcl1Pp imYfWc/D1W9z+yFnf5yzOGN8iZ8VUXfQdgSLEhlTCEnu9Euo/lgzxpOrhEtE0tuPzTrQ eMzVREcnyVm9yGvVgkixz6o+j30XjsjkynhbwBCYqZ8bET5JPn72XAHvgE27ks7x9yJL 7h2w== X-Gm-Message-State: ALoCoQmLQoGpcAcAhMbnY888tWI0CgiOWuCKON28gfB43rG+QZleGmEZ+ui8u1n7s6bvuNGcCKha MIME-Version: 1.0 X-Received: by 10.236.104.194 with SMTP id i42mr36566744yhg.89.1426089175966; Wed, 11 Mar 2015 08:52:55 -0700 (PDT) Received: by 10.170.71.86 with HTTP; Wed, 11 Mar 2015 08:52:55 -0700 (PDT) X-Originating-IP: [2.98.214.239] In-Reply-To: References: Date: Wed, 11 Mar 2015 15:52:55 +0000 Message-ID: To: Zeev Suraski Cc: PHP internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] [VOTE][RFC] Coercive Scalar Type Hints From: danack@basereality.com (Dan Ackroyd) Voting no due to: i) Having conversion rules be difference in userland to internal functions. You list 'Single Mode' as a benefit of this RFC, but it's only single mode if you gloss over this difference. This is a massive cognitive load, and will be one of those issues that catches users out again and again. Why on earth should a boolean be convertible to int for some functions but not others? What will happen when someone writes code that extends an internal class and overrides one of the functions, is that the person who is using that extended class will have to alter their code to use the extended class in a different way to how they would use the built in class directly. For everyone who didn't pick this up in the RFC, it's hidden in the large chunk of text: "Unlike user-land scalar type hints, internal functions will accept nulls as valid scalars." ii) The subtle BC breaks. false -> int # No more conversion from bool true -> string # No more conversion from bool btw You appear to have only tested this code against barebones frameworks. These are often written far more cleanly than actual applications so I don't think the report of 'very limited' BC breaks is accurate. iii) Having conversion work, except when they don't. People who want weak type hints want weak type hints - they don't want code that breaks unexpectedly. function foo(int $bar){...} foo(36/$value); // works when $value = 1, 2, 3, 4 breaks when $value = 5 This is neither weak nor strict type - this is a horrible hybrid that would only catch people out. But finally, the fact that a significant part of the RFC is talking about how the behaviour will need to be cleaned up in a future RFC, but at the same time that some of the problems will be left for five years show that this isn't a sensible RFC to vote for, even for the people who just want weak types cheers Dan . On 11 March 2015 at 15:10, Zeev Suraski wrote: > The vote on the Coercive Scalar Type Hints is now open for voting. > > > > The latest version of the RFC includes changes discussed on internals@ last > week: > > 1. Accept string->bool and int->bool conversions (false->bool is not > supported) > > 2. Accept leading/trailing spaces in string->number conversions. > > > > wiki.php.net/rfc/coercive_sth > > wiki.php.net/rfc/coercive_sth#vote > > > > Thanks! > > > > Zeev