Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:80117 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 40653 invoked from network); 3 Jan 2015 06:04:22 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Jan 2015 06:04:22 -0000 Authentication-Results: pb1.pair.com smtp.mail=pierre.php@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=pierre.php@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.181 as permitted sender) X-PHP-List-Original-Sender: pierre.php@gmail.com X-Host-Fingerprint: 209.85.216.181 mail-qc0-f181.google.com Received: from [209.85.216.181] ([209.85.216.181:49294] helo=mail-qc0-f181.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BD/11-32964-56687A45 for ; Sat, 03 Jan 2015 01:04:22 -0500 Received: by mail-qc0-f181.google.com with SMTP id m20so13550920qcx.40 for ; Fri, 02 Jan 2015 22:04:19 -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=NgRt9dfc+q/jzmSDRzT0AZQB8uZQnikJz2NPYVtR8Qk=; b=RmpZttTzJgtlITIkQqvPzTRJdgL3O+uzELsiz3rOYdR3nqU+8ZwRWPPUiDsj4ZV89m zLvvWCju2dHc1W/DRFYAOa0xUVB7LEbpkInzOsFWj3S3HL0eAmGzQLlHK4OqDJAGbtOB wzmKH5MfDKkqh7Za6CKyLJCtoCVC7J9kgdqVLn6UoaFeHKdM1EgkRRrzEhLRiMeuDPnf soxntVOfaf3f4FE1eu5ut3+SXTtxC6b6zAxt7yXldlK5o/o2IOyaFKl8zeg3uJ7Wq04f HTMzmGhVHIbaVBeYRX2wLesov/cX1DquFtOqMAy+aaAD4dk9j8geY9SoyVtPMIIikpmY tyHQ== MIME-Version: 1.0 X-Received: by 10.140.89.18 with SMTP id u18mr121165097qgd.20.1420265059049; Fri, 02 Jan 2015 22:04:19 -0800 (PST) Received: by 10.140.22.106 with HTTP; Fri, 2 Jan 2015 22:04:18 -0800 (PST) In-Reply-To: <54A78410.3050600@gmail.com> References: <41D5BB0B-73AF-488E-968D-90B2878E3178@ajf.me> <54A778AB.6020804@gmail.com> <54A78410.3050600@gmail.com> Date: Fri, 2 Jan 2015 22:04:18 -0800 Message-ID: To: Stanislav Malyshev Cc: Andrea Faulds , PHP Internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] [RFC] Scalar Type Hints From: pierre.php@gmail.com (Pierre Joye) On Fri, Jan 2, 2015 at 9:54 PM, Stanislav Malyshev wrote: > Hi! > >> I am not sure about that. Parameters handling is one specific case, >> userland parameter handling even more. It could be a good move to do > > Making internal and userland parameters work differently and having > scalar type errors behave differently from object type errors by having > one throw exceptions and another errors looks like a mistake to me. It > only makes handling errors harder as you'd have to handle two types of > situations instead of one. I was not clear, sorry. Parameter handling in general as described in this RFC are a special case. This addition is somehow different from other arguments handling we have, whether it is used for internal functions or userland. I only see Exceptions even more useful in userland code. There is no change per se to existing functions. Or to say it in a better way, I am not keen to begin to chagne every 2nd internal function to apply this new RFC, it could cause some bad headaches. However, new functions and the likes, explicitally relying on this RFC, may be a good candidate to have a different handling for bad argument. >> that as a 1st step, with this RFC. > > I don't think "1st step" is a good approach here. The language should > provide consistent expectations, including about what happens when you > pass certain data to it, including error conditions. If we have > different types of error conditions between internal and userland > functions, it would not be a good thing. Agreed, but still. New userland codes could have huge benefits if we allow that. But changing every internal function may have a bad impact. > We should make all parameter handling work the same way - so if you pass > a parameter and it does not match the expectations, you know what you're > getting. If it works one way to internals, another for user functions, > it would only make it harder to handle. Right again. Still not sure about the perfect solution without impacting too much existing userland code. Cheers, -- Pierre @pierrejoye | http://www.libgd.org