Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:79056 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 40540 invoked from network); 21 Nov 2014 01:22:34 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Nov 2014 01:22:34 -0000 Authentication-Results: pb1.pair.com smtp.mail=davidkmuir@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=davidkmuir@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.50 as permitted sender) X-PHP-List-Original-Sender: davidkmuir@gmail.com X-Host-Fingerprint: 209.85.220.50 mail-pa0-f50.google.com Received: from [209.85.220.50] ([209.85.220.50:43121] helo=mail-pa0-f50.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8C/F0-32541-9D39E645 for ; Thu, 20 Nov 2014 20:22:34 -0500 Received: by mail-pa0-f50.google.com with SMTP id bj1so3710877pad.37 for ; Thu, 20 Nov 2014 17:22:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=references:mime-version:in-reply-to:content-type :content-transfer-encoding:message-id:cc:from:subject:date:to; bh=skBknML3xd/UHz9elkDctegLoigkpT7FVI/qGbvYBNk=; b=qV44M9b87P0XDA30KicXyh0sYPv2tDT8L8TuE+G+gseKjXWuOavfd3WtY16sP3MUCa BmNh2X7L+ia1n/bO8PTn7WXvT1PUEzZC/+bLURoIFxcfObDLSia4yCoztdz1XxpVQTkq pvVZKzi2m/xOQWODaRTSqSK5Y5lumYoyVzb+AeYkUJl0r0QtqfZrEY/vzn38kUoZ+FNH S0k4U54IAjvLUG/D7m1tkVNNALO9MJVUYcPmhlKXEQ8sjc+uhKGsYsq8wnYWVSdzmpYO rCUN9iEGt8KEHLAl2B/bw014xQcmS1E4XlNn+La6PZtzAb8sCdHY/vdJGjunhYK0fbey TEGg== X-Received: by 10.66.100.136 with SMTP id ey8mr1910790pab.93.1416532951207; Thu, 20 Nov 2014 17:22:31 -0800 (PST) Received: from [10.168.125.228] (pa49-183-161-247.pa.vic.optusnet.com.au. [49.183.161.247]) by mx.google.com with ESMTPSA id df1sm3164453pbb.2.2014.11.20.17.22.29 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 20 Nov 2014 17:22:29 -0800 (PST) References: Mime-Version: 1.0 (1.0) In-Reply-To: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <3A69F0F5-C5FE-415D-A894-193D9F146854@gmail.com> Cc: Levi Morrison , Andrea Faulds , PHP Internals X-Mailer: iPhone Mail (11D257) Date: Fri, 21 Nov 2014 12:22:22 +1100 To: Adam Harvey Subject: Re: [PHP-DEV] [VOTE][RFC] Safe Casting Functions From: davidkmuir@gmail.com (David Muir) Not a voter, but I don't really see the usefulness of this in core either. Sent from my iPhone > On 21 Nov 2014, at 11:45 am, Adam Harvey wrote: > > My -1 is pretty much the same as Levi's: > >> On 19 November 2014 13:57, Levi Morrison wrote: >> - The RFC does not address how this is different from >> FILTER_VALIDATE_* from ext/filter. I know there was a mention of this >> on the mailing list, but the RFC should say why a tool that already >> exists to solve this kind of problem is insufficient, especially when >> it is enabled by default. > > I'm also somewhat concerned that these functions are conflating two > concerns (validation and conversion). > >> - PHP suffers a lot from function bloat and this RFC provides >> multiple functions that do the same thing but differ only in how they >> handle errors. A simple validation of "can this be safely cast to an >> integer without dataloss?" avoid the issue entirely and would be fewer >> functions. > > +1: the idea of adding two sets of identical functions except for how > they signal errors isn't one I like. > > Derick raised a good point elsethread: this is really tied into how we > want to signal errors in PHP 7. If we switch to exceptions, then let's > figure out a plan of attack and switch to exceptions everywhere, not > just in the odd function here and there. If we don't, then the to_* > functions shouldn't be added. > >> To summarize: I like the idea of having tools that helps us convert >> between types in a lossless way, but I don't think this proposal is >> what is best for PHP. -1 for me but I hope to see this revisited. > > I don't know that I'd ever be a strong +1 on this (adding more type > conversion matrices to PHP doesn't seem like a good idea to me, > whether it's in the language itself or in the standard library, and I > feel like we have the validation part of this already in filter and > ctype), but if we figured out the error handling situation and had > only one set of functions, I could probably grit my teeth and abstain, > at least. > > Adam > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php >