Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:78218 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 11817 invoked from network); 22 Oct 2014 08:08:00 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Oct 2014 08:08:00 -0000 Authentication-Results: pb1.pair.com header.from=lester@lsces.co.uk; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=lester@lsces.co.uk; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain lsces.co.uk from 217.147.176.214 cause and error) X-PHP-List-Original-Sender: lester@lsces.co.uk X-Host-Fingerprint: 217.147.176.214 mail4-2.serversure.net Linux 2.6 Received: from [217.147.176.214] ([217.147.176.214:51296] helo=mail4.serversure.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 36/11-01590-DD567445 for ; Wed, 22 Oct 2014 04:07:59 -0400 Received: (qmail 29502 invoked by uid 89); 22 Oct 2014 08:07:55 -0000 Received: by simscan 1.3.1 ppid: 29496, pid: 29499, t: 0.1461s scanners: attach: 1.3.1 clamav: 0.96/m:52/d:10677 Received: from unknown (HELO ?10.0.0.8?) (lester@rainbowdigitalmedia.org.uk@86.178.187.131) by mail4.serversure.net with ESMTPA; 22 Oct 2014 08:07:55 -0000 Message-ID: <544765DA.1040704@lsces.co.uk> Date: Wed, 22 Oct 2014 09:07:54 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.0 MIME-Version: 1.0 To: internals@lists.php.net References: <66B7B28C-2651-4A71-AC2A-55D4C7BB3DDC@ajf.me> <866A39C7-6F11-408D-8BCA-594BA22E8569@ajf.me> In-Reply-To: <866A39C7-6F11-408D-8BCA-594BA22E8569@ajf.me> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] [RFC] Safe Casting Functions From: lester@lsces.co.uk (Lester Caine) On 21/10/14 23:51, Andrea Faulds wrote: > I am gradually warming to throwing an exception. An interesting idea I’ve had suggested on Twitter was by Matt Parker, who suggested that I add an optional 2nd argument. Without the argument, it throws an exception. With an argument, it returns that value (as a default) instead of throwing an exception. Now that sounds like a nice compromise in a few places where exceptions have been introduced, but I still think this is still a little chicken and egg. If it is going to 'fail' then the reason for the failure is more important than simply producing no answer. Especially if it is going to fail in different inputs to other methods. Again forcing an exception only solution sidesteps that debate! -- Lester Caine - G8HFL ----------------------------- Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk Rainbow Digital Media - http://rainbowdigitalmedia.co.uk