Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:85192 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 28553 invoked from network); 18 Mar 2015 13:12:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Mar 2015 13:12:29 -0000 Authentication-Results: pb1.pair.com header.from=pajousek@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=pajousek@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.192.53 as permitted sender) X-PHP-List-Original-Sender: pajousek@gmail.com X-Host-Fingerprint: 209.85.192.53 mail-qg0-f53.google.com Received: from [209.85.192.53] ([209.85.192.53:32921] helo=mail-qg0-f53.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 12/57-22462-DB979055 for ; Wed, 18 Mar 2015 08:12:29 -0500 Received: by qgfa8 with SMTP id a8so35806054qgf.0 for ; Wed, 18 Mar 2015 06:12:27 -0700 (PDT) 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=L/ULfqMHp4e3wxq/aNhPIQN/CQWQ2i5Zjep4vBVBoBw=; b=Q0i1Loond7CQikmZTCvz4Qq8s7v7UJTNhNocdZOzl6z2jS9bBJwUeYjuOIQRBm2MIf D0Qm38Bht1ProGcfQN1Ex1io1l/zyO2PmQiG56ikmiTF8VPKtnMgPQ6SxXOg1Xjquj92 e00K3G2XFGKrzoyK5/wOoCIyjWMRud1AYJaOiq1eVRRJsGJHxoeLHKJ6Z9YcjI9Vy/DM ZOPN7B7NN8vKbIsYQMhv52r89YRjbKZWtl5tM+gr4BsJ1tIL1Ru2seXxTpKw9ZxYu+50 MNXaU0qImqvA31CaEbxXK2h7IFpPCgc/bmq7Eqyzw2pSKygqq6SG7nT1/MRxQqIQjhwu UDlQ== MIME-Version: 1.0 X-Received: by 10.55.55.81 with SMTP id e78mr142320776qka.107.1426684347311; Wed, 18 Mar 2015 06:12:27 -0700 (PDT) Received: by 10.96.160.99 with HTTP; Wed, 18 Mar 2015 06:12:27 -0700 (PDT) In-Reply-To: References: Date: Wed, 18 Mar 2015 14:12:27 +0100 Message-ID: To: Nikita Nefedov Cc: PHP internals Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [RFC][Accepted] Scalar Type Declarations V0.5 From: pajousek@gmail.com (=?UTF-8?Q?Pavel_Kou=C5=99il?=) On Wed, Mar 18, 2015 at 2:02 PM, Nikita Nefedov wrote: > On 18 Mar 2015 15:52, "Pavel Kou=C5=99il" wrote: >> >> Hello, >> >> I made that conclusion because in the first example, the library kinda >> forces strict mode rules on the caller, even if he doesn't want to use >> strict mode - this makes the interoperability of the two modes >> problematic. > > This is incorrect, library force itself to use right types, not you. I do= n't > see any problems here. The only thing that for sure lacks in PHP and that > would make STH better is callable signature types. > Well, it forces you to do that, basically. And also forces you to "care" about the mode of library, adding mental overhead. Look more closesly at the first example - does the error in that case make sense to you (from purely user's point of view)? When you call a(function(int $b) {return $b * 2; }) - should you really be required to check the context within the a() is declared? >> Also, the other possible outcome of the scenario (respecting the mode >> of the place where the callback is declared), is IMHO problematic as >> well, because it does not respect the strict mode of the place where >> it is called, making it inconsistent with how the dual mode RFC works >> in general. > > It doesn't matter where the callback or function was declared, it only > matters where it was called. It pretty much is consistent. This was just a comment about how it would be (also) wrong to solve it the other way around.