Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:102967 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 33288 invoked from network); 25 Jul 2018 01:49:12 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Jul 2018 01:49:12 -0000 Authentication-Results: pb1.pair.com header.from=levim@php.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=morrison.levi@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.167.45 as permitted sender) X-PHP-List-Original-Sender: morrison.levi@gmail.com X-Host-Fingerprint: 209.85.167.45 mail-lf1-f45.google.com Received: from [209.85.167.45] ([209.85.167.45:40662] helo=mail-lf1-f45.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 90/BC-12660-717D75B5 for ; Tue, 24 Jul 2018 21:49:11 -0400 Received: by mail-lf1-f45.google.com with SMTP id y200-v6so4293282lfd.7 for ; Tue, 24 Jul 2018 18:49:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ydLjQR5IJIYWWK7GIGUAlggQb2i0c4EFP3w3L+GDWCk=; b=GcSO1z3KBBlUjzfYyJiRJKutVyr7TA0xp56eDHawM0HoFSaLO28yHm96sMSvG9KliD zynjedScwJ5rCzpajsqmQ0r5rLjW4c/y2hXhiBBOd7esB2WtNIxlpi4A9YgCs9Haa9qQ SZIZX878o4V7DyXQtSWf2gcGinf/xt3ETX46N9CuN09pp/7zmQu0qWY7+MIGxKtT5V+C cJtlDhrpoOsCckdS9dQNoG7CCPIuQ7hd9aiii1lIytooIZ54hhhOh5iYU8l1i0sJUryx gVvKI+r3TH4UcO091xPzUyw0ul1p/d9oqAn9uB2nthRd+l/Ci27Xt51QSC+NkgdRpuJX nFkg== X-Gm-Message-State: AOUpUlEOgUCegfewBEwWLe0TxQL+9du89Bjsv5yklQsQkHT/PFTrtFwS CF1dSqU4zbLJAAnX1pkeyITJ6xrAQM0a8z9JEqg= X-Google-Smtp-Source: AAOMgpe+guqWWpIXhx4wGR2EC7nloed8oHrDGn8+ia+UqVE88LbxNcrXD0gECfWLCATA4zdOWFy8TDOU5AQ6lsiSdcI= X-Received: by 2002:a19:5309:: with SMTP id h9-v6mr11790283lfb.86.1532483348365; Tue, 24 Jul 2018 18:49:08 -0700 (PDT) MIME-Version: 1.0 References: <22a291a9-7bca-5dc1-d29a-603e1fe3898d@gmail.com> In-Reply-To: <22a291a9-7bca-5dc1-d29a-603e1fe3898d@gmail.com> Date: Tue, 24 Jul 2018 19:48:51 -0600 Message-ID: To: Stas Malyshev Cc: Nikita Popov , internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] Implementation ideas for adding early warning for mis-use of "parent"? From: levim@php.net (Levi Morrison) On Tue, Jul 24, 2018 at 1:15 AM Stanislav Malyshev wrote: > > Hi! > > > Please note that for traits and closures it's not possible to determine > > this at compile time. > > Why not for closures? I thought closures are bound at definition site, > and thus should know everything at compile time? > > -- > Stas Malyshev > smalyshev@gmail.com > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php Closures can be rebound to another scope; see [Closure::bindTo][1]'s second parameter. I have a [pull request][2] that adds a compile-time warning for usages of "parent" without a parent. It need a review; there is a case where the warning is emitted twice and I don't know what to do. [1]: https://secure.php.net/manual/en/closure.bindto.php [2]: https://github.com/php/php-src/pull/3404