Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:95679 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 88533 invoked from network); 5 Sep 2016 23:25:35 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Sep 2016 23:25:35 -0000 Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.161.175 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.161.175 mail-yw0-f175.google.com Received: from [209.85.161.175] ([209.85.161.175:35425] helo=mail-yw0-f175.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D4/EB-45301-EEEFDC75 for ; Mon, 05 Sep 2016 19:25:35 -0400 Received: by mail-yw0-f175.google.com with SMTP id j1so24814471ywb.2 for ; Mon, 05 Sep 2016 16:25:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=rKCgagSLjDNwCjbF0Kjz+qz3BTTnRvMT7uQia2vIM+0=; b=hF45ZLYR1gdgOJao9khjzoh6suDt+ng3kcHmZJxISIaEca4BgjsvmMLN3vwZa6O/Rh SAKzZ2wTNqrEOHzMh1w8+72XQUfPyyt9On3GO7yczKFV3VouUnLLgvIXMcIdpEhc739H HVjxGRlnItVpBXtyhE3eLoW/buQ4E6TV5hRxvTFPCocpREvglBpbEqouaatcC1Pi+Fg2 NeDDSesvPMftS2epj67bLUDRhiw97AgJwIAMxKVGgMWKHsfU0TLMG9ZdrTu0NJVhnVR1 Ahb3eVSilRslInRbMYZVHqTyNFVP2whcYmHkhSh4HqEYQHEVDV/brXS+/z4bRMsTINIf LxNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=rKCgagSLjDNwCjbF0Kjz+qz3BTTnRvMT7uQia2vIM+0=; b=DBp9vhuTYqJ8VcszoRADd03OMKsXQNbcDzAVbeRjUD7Ygs0jlbiqjnKMuvjqfJRvS6 /0cFtQXU+/dLEnL9gNhfIo8mFMeMBao11KkiIf81FU2c5G3djY9jQlUARYfBtADpnb2K X28IFL7CkHR5iNsiz+CMo1ud8baAKbSQe8KRpoo0FNnqpkf9WamwQNsPZJLRi/klMalj ACwsSrkNSd0+WcPfQFWs6CEPx/KwZuitNgktILTkwswxY5DHC409zB80hRKd8D6w0gID gGE2e3SeM3ucT2QUFe0ca1JABTPDxUqlUVQlhQNKIZ3e7ZsHcb1s/iJo+/csq+jqYdbZ 4DVg== X-Gm-Message-State: AE9vXwP5aPV4sxlyKBNsuvdsy/VKBSrczbQjj4NPSqhFC5aTUtyeCMn/ifm1fzVtFMm5x9pNqv73gtZlNiAcuw== X-Received: by 10.13.221.198 with SMTP id g189mr31139083ywe.93.1473117931842; Mon, 05 Sep 2016 16:25:31 -0700 (PDT) MIME-Version: 1.0 Received: by 10.13.215.15 with HTTP; Mon, 5 Sep 2016 16:25:31 -0700 (PDT) In-Reply-To: <08.EA.45301.80FDDC75@pb1.pair.com> References: <08.EA.45301.80FDDC75@pb1.pair.com> Date: Tue, 6 Sep 2016 01:25:31 +0200 Message-ID: To: Andrea Faulds Cc: PHP internals Content-Type: multipart/alternative; boundary=94eb2c0779ce0a31a2053bcaffe1 Subject: Re: [PHP-DEV] Missing reflection info about strict types? From: nikita.ppv@gmail.com (Nikita Popov) --94eb2c0779ce0a31a2053bcaffe1 Content-Type: text/plain; charset=UTF-8 On Mon, Sep 5, 2016 at 11:09 PM, Andrea Faulds wrote: > Hi Nikita, > > Nikita Popov wrote: > >> As I see it, the issue here is really not how to figure out whether a file >> uses strict_types, the issue is how you mix strict_types=1 and >> strict_types=0 code in a single file. >> > > This is also my assessment. > > Back when this feature was introduced, we decided not to allow this kind of >> mixing, as it seemed prone to causing a mess and use-cases seemed >> doubtful. >> Given the issue Symfony is experiencing, we should reevaluate this >> decision. Imho it's not good if there are some things you simply *cannot* >> express in a single file. >> > > I think it was things like this that made me initially allow having > multiple strict_types declarations in a file. But that was changed later. > > Maybe we could allow it, but only with the block syntax, much as we do > with namespaces? i.e.: > > declare (strict_types=1) { > > } > > declare (strict_types=0) { > > } > > Or we could allow any number of non-block strict_types declarations if we > wanted. I don't know. Next to the question of which syntax specifically we want to allow, this will also be somewhat challenging to implement, or may require further semantic restrictions. Currently we only store strict_type information at the op_array level, which means that we have no way of representing something like: declare(strict_types=1) { foo($bar); } declare(strict_types=0) { foo($bar); } This means that we either a) have to represent strict_types at a more granular level, which effectively means that we have to store this on every call or verify-return opcode. b) or we need to restrict this kind of mixed usage further, such that each block may only contain declarations. I.e. while the above example would be forbidden, one could still write declare(strict_types=1) { function foo() {} } declare(strict_types=0) { function bar() {} } This would satisfy the given use-case, but it would also introduce a somewhat arbitrary seeming limitation. Nikita --94eb2c0779ce0a31a2053bcaffe1--