Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:81659 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 65181 invoked from network); 2 Feb 2015 21:41:56 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Feb 2015 21:41:56 -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:50828] helo=mail4.serversure.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 41/78-25089-22FEFC45 for ; Mon, 02 Feb 2015 16:41:55 -0500 Received: (qmail 14623 invoked by uid 89); 2 Feb 2015 21:41:50 -0000 Received: by simscan 1.3.1 ppid: 14617, pid: 14620, t: 0.0637s 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.189.147.37) by mail4.serversure.net with ESMTPA; 2 Feb 2015 21:41:50 -0000 Message-ID: <54CFEF1E.7080409@lsces.co.uk> Date: Mon, 02 Feb 2015 21:41:50 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: internals@lists.php.net References: <20150202210349.6FB91261948@dd15934.kasserver.com> <54CFE965.2080905@gmx.de> In-Reply-To: <54CFE965.2080905@gmx.de> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] What do we need strict scalar type hints for? From: lester@lsces.co.uk (Lester Caine) On 02/02/15 21:17, Christoph Becker wrote: >> Instead of multiple strict scalar hints (e.g. function addVat(int|float $amount){...}), I would prefer to have "numeric" as strict type: >> > function addVat(numeric $amount){...} > Have you considered > > addVat(-1); Also addVat(1.235); which will be rounded to two decimal places ... silently in this case. A negative amount may be acceptable - credit note - and a one off price may be a finer fraction, but this example shows a couple of other potential errors. As I have already said ... 'strict' may well only be a subset of the error check. A "numeric" type would introduce the problem of scale of number. Something which any of the database extensions already manage on a field by field basis. -- 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