Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:85182 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 7315 invoked from network); 18 Mar 2015 11:31:20 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Mar 2015 11:31:20 -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.192.43 as permitted sender) X-PHP-List-Original-Sender: pajousek@gmail.com X-Host-Fingerprint: 209.85.192.43 mail-qg0-f43.google.com Received: from [209.85.192.43] ([209.85.192.43:34322] helo=mail-qg0-f43.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C3/33-22462-70269055 for ; Wed, 18 Mar 2015 06:31:20 -0500 Received: by qgh62 with SMTP id 62so33533770qgh.1 for ; Wed, 18 Mar 2015 04:31:17 -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; bh=ZBCDVFhS2u3N1iy1pTFeINJFoB7B5mzKSPR3vB+yTEc=; b=LG8hhzQkVEHIe+cIdbIQAxJ0wVT7BjobuHgr8PMLcZ/jjycgZUgzaCjakGSyL2MNV0 UM20bxOaP5UAUPcr3QOyOGBALyMrXA2vKu+8BHU4QZXn5BIoGzDA7rfQbCzL8Z9lpjDC PNzzSdJZXEM1VWmkU1EEwUjpRe6tarA7DwWha3Scisuau5KIs6T3J4VahItAnBpEVnY8 L23Lm3cxEU8D6tzDUjLebn+kGDNkYzacmor9PGvrfGBo56nGNG9bv8ttpnPIHHfGmzFy vQmT2wZy/mNzlCpNZ2BWXs8IaJi9sAVg7u9L2JaMJ+/DEN6+GHsg0AiPD6ouAh7lwvkd 5viQ== MIME-Version: 1.0 X-Received: by 10.140.239.150 with SMTP id k144mr91372551qhc.77.1426678277355; Wed, 18 Mar 2015 04:31:17 -0700 (PDT) Received: by 10.96.160.99 with HTTP; Wed, 18 Mar 2015 04:31:17 -0700 (PDT) In-Reply-To: References: Date: Wed, 18 Mar 2015 12:31:17 +0100 Message-ID: To: Patrick ALLAERT Cc: Anthony Ferrara , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=001a11358876ee42d605118e6baa Subject: Re: [PHP-DEV] [RFC][Accepted] Scalar Type Declarations V0.5 From: pajousek@gmail.com (=?UTF-8?Q?Pavel_Kou=C5=99il?=) --001a11358876ee42d605118e6baa Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Wednesday, March 18, 2015, Patrick ALLAERT wrote: > Le mer. 18 mars 2015 =C3=A0 10:56, Pavel Kou=C5=99il = a =C3=A9crit : >> >> Hello, >> >> how will these examples work btw? >> >> // a.php >> > declare(strict_types=3D1); >> function foo($fn) { >> $fn("1"); >> }; >> >> // b.php >> > require 'a.php'; >> foo(function (int $a) { return $a * 2; }); >> >> >> >> // c.php >> > function foo($fn) { >> $fn("1"); >> }; >> >> // d.php >> > declare(strict_types=3D1); >> require 'c.php'; >> foo(function (int $a) { return $a * 2; }); >> >> I can't find this in the RFC. I'd intuitively expect error in the >> first example and the second one to work OK. > > Your intuition is correct. > >> >> But at the same time, if there will be an error in the first example, >> it is IMHO a huge flaw with this RFC. :/ > > Flaw vs. design choice. This is one of the reason that this aspect, amongst others, has been very debated. But if it works this way, the strict mode isn't optional and users of a library NEED to care which mode the library uses? --001a11358876ee42d605118e6baa--