Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:83917 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 64653 invoked from network); 26 Feb 2015 19:29:31 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Feb 2015 19:29:31 -0000 Authentication-Results: pb1.pair.com header.from=ircmaxell@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ircmaxell@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.217.173 as permitted sender) X-PHP-List-Original-Sender: ircmaxell@gmail.com X-Host-Fingerprint: 209.85.217.173 mail-lb0-f173.google.com Received: from [209.85.217.173] ([209.85.217.173:43411] helo=mail-lb0-f173.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id EE/4C-32582-A147FE45 for ; Thu, 26 Feb 2015 14:29:31 -0500 Received: by lbiw7 with SMTP id w7so12951984lbi.10 for ; Thu, 26 Feb 2015 11:29:27 -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=t320WZc9GvJOKx4VfoDEM4/ImyVPbfshCEvRZwjAwZI=; b=OsN4FeMCghP1JNzsYrE7gcCH9bmqSqSgUiAfDNUJ16BTUZYccIt3OnbqXE4lX9OdJp 40Mi4Rb4n9mTB6sbWBUx8b7b0jXDjptSGz3fespSRuotQ57dMfg+/CIGFsjnlqWFXB6O 3NXGALK3I2X1DPmbdrT13TBD+pk4v3P8lkwuxI6Lftl3DlTByzHTC5w85J1Up/KboSyt gK6OPQ63Axu5XIvb1Gj2S/5XEjxPOe94eRZY0IsJcy9PhLGoxr+HBPp8kpOrjfVQEJZN MQovfe0U33TrcUAGww9CJdRLfmEHW7/ZGN0JYPAGY3C9llng9fXjGlTvqkRDPOerN2uE n6uQ== MIME-Version: 1.0 X-Received: by 10.112.139.136 with SMTP id qy8mr9329964lbb.38.1424978967700; Thu, 26 Feb 2015 11:29:27 -0800 (PST) Received: by 10.25.43.9 with HTTP; Thu, 26 Feb 2015 11:29:27 -0800 (PST) In-Reply-To: References: <3d639901ae85227b219e7ee59b3140fe@mail.gmail.com> Date: Thu, 26 Feb 2015 14:29:27 -0500 Message-ID: To: Mike Willbanks Cc: Dan Ackroyd , Zeev Suraski , Theodore Brown , "internals@lists.php.net" Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] A different user perspective on scalar type declarations From: ircmaxell@gmail.com (Anthony Ferrara) Mike, One point of clarification: > This is true, however, the types that you are receiving back form a > multitude of data sources might be in a mixed format (databases for example > often provide representation back as a string, non-json based web services > provide mainly as a string, etc). While I know what my data looks like > and I know I am always going to get a "string" integer back I do not want > to have to type cast this each and every time. Or that I have a boolean > integer representation that is in a string... You get the point. Sure, I > could certainly go in and take 5 minutes and cast each one but I'm not > certain why the purpose is there... It specifically changes the > determination that PHP is a weakly typed language and all of a sudden I now > need to care that my string integer boolean is not actually a boolean. It's funny that you bring up boolean... With the current coercive proposal, you will still need to worry about the types: https://wiki.php.net/rfc/coercive_sth#coercion_rules Passing boolean(false) where an integer is expected will generate an error. This is a common practice, specifically around internal functions. Example: https://github.com/sebastianbergmann/phpunit/blob/a4e23a10d4eeea5fd9fe8916859a07430b94cf42/src/Util/ErrorHandler.php#L58 So yes, you'll still need to go in and cast each one **in both RFCs** (or handle the errors properly). The difference is with the dual-mode RFC you can choose not to have to cast and keep everything as-is today (or more specifically, you need to explicitly choose strict mode). And you can have user-land behave identically to internals **in both cases**. Anthony