Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:82878 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 12741 invoked from network); 16 Feb 2015 19:11:41 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Feb 2015 19:11:41 -0000 Authentication-Results: pb1.pair.com smtp.mail=pajousek@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=pajousek@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.180 as permitted sender) X-PHP-List-Original-Sender: pajousek@gmail.com X-Host-Fingerprint: 209.85.216.180 mail-qc0-f180.google.com Received: from [209.85.216.180] ([209.85.216.180:32861] helo=mail-qc0-f180.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C8/FB-36518-DE042E45 for ; Mon, 16 Feb 2015 14:11:41 -0500 Received: by mail-qc0-f180.google.com with SMTP id s11so25435812qcv.11 for ; Mon, 16 Feb 2015 11:11:39 -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:content-transfer-encoding; bh=tzg2o18YSMighd7BH6IUVNgjGMvUtiud8aOu5RfWo1Q=; b=NuHyQ2rfBSyAIVQqbdgCbEW5s1SM2sBZvYVs36RhX7K5BX67EeK4HBJZf3gUQ7Da5C fIkvQ6H8z41Lylw8jJY+3yYmjlP9UggCMfry6Avv7lS5TBP5FvLVp8jDpHZwM+S7opYw KXtf053rM/I47otgLMlJkiut1EMsGLEFJy+a1tHLn8ii3Rg00ebJbG6OeWsEcVO7QMku grqNjZsWQeP3pKSkZzi2MbvcRHttMtQuzGNy1+4IE4iAdTvT+Iof50S4ZIt+mgXyVdcz nt1EZLLnMiw7WPE9Fdwax2aYjeRQLDAjT1v+qujBMXUJxtkkXlWWyDOBmW1R5N4xHmDb +pXw== MIME-Version: 1.0 X-Received: by 10.140.232.206 with SMTP id d197mr611677qhc.79.1424113899069; Mon, 16 Feb 2015 11:11:39 -0800 (PST) Received: by 10.96.66.201 with HTTP; Mon, 16 Feb 2015 11:11:39 -0800 (PST) In-Reply-To: <011801d04a07$83ab1c00$8b015400$@php.net> References: <011801d04a07$83ab1c00$8b015400$@php.net> Date: Mon, 16 Feb 2015 20:11:39 +0100 Message-ID: To: francois@php.net Cc: Arvids Godjuks , Jefferson Gonzalez , Rowan Collins , PHP internals Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Reviving scalar type hints From: pajousek@gmail.com (=?UTF-8?Q?Pavel_Kou=C5=99il?=) On Mon, Feb 16, 2015 at 5:42 PM, Fran=C3=A7ois Laupretre = wrote: > Hi, > > - the fact that the RFC supports single types only, like the previous 're= turn type' RFC. While it is easier to implement, it opens several issues as= multiply-typed arguments are an integral part of the PHP language (mostly = completeness and compatibility with internal function hinting). If we want = to support multiple types the same way for internal and userspace functions= , we must extend the ZPP layer to support it. > > - the mechanism to check for type hints on internal functions, while easy= to implement, is not sufficient, as a lot of internal functions get a bare= zval from the parsing system and then convert it by themselves. With the p= roposed mechanism, there's no possible hinting on such argument, which will= make the implementation different from the documentation. Even if the chec= k is done by the function body, it won't be done in a consistent way with t= ype hinting checks and won't raise a similar error. As most cases are relat= ed to multiply-typed args, the solution is in adding multiply-typed support= to ZPP. Multiply-typed support needs to redefine scalar conversion rules, = to take care of the target type being a combination of single types. > Hello, I know this is probably a pretty unpopular opinion in PHP (based on the replies I got in the other thread), but different values for parameters should be IMHO solved by method overloading and such. Regards Pavel Kouril