Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:107712 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 82399 invoked from network); 28 Oct 2019 02:45:39 -0000 Received: from unknown (HELO php-smtp3.php.net) (208.43.231.12) by pb1.pair.com with SMTP; 28 Oct 2019 02:45:39 -0000 Received: from php-smtp3.php.net (localhost [127.0.0.1]) by php-smtp3.php.net (Postfix) with ESMTP id 89A102CC929 for ; Sun, 27 Oct 2019 17:32:55 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp3.php.net X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS3215 2.6.0.0/16 X-Spam-Virus: No Received: from mail-il1-x136.google.com (mail-il1-x136.google.com [IPv6:2607:f8b0:4864:20::136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp3.php.net (Postfix) with ESMTPS for ; Sun, 27 Oct 2019 17:32:55 -0700 (PDT) Received: by mail-il1-x136.google.com with SMTP id v2so6647641ilq.4 for ; Sun, 27 Oct 2019 17:32:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=bVfVjRdQTJ/xmgfP/Kwsk7sSbB8D334RyAW2q6PFS54=; b=fdaxBlFh7wlnJ6c3pjniF5JEizhy/MqmKoYXII4S7Aue4oodJ2ATx9hWsvQsg1mNnl I50okfwAV4DCOvolt14bbpUVMsKSqbdcpcTz6F5dZwMoFopBMuZesZP+pv6WQ5WQjfKc a2FlEA+Bhzd4f3GQ+RJufqYxEzc7v780FC6ZnV8V8MavCdbCd0rH90e5+eDRBiI0m+PK 6jS84Wl1PCl5yY0UpAanckah8DaZFr/ZSZKiRPzXDHlsD/4jK1MiPmtI/doYXfHv9Z+G pIpF86GmJszQPRlntlovlRqua7WyqB1g9E9tjjJeXqhBzD7XpihrAUUwq9a+mNbK0oy+ nhhA== 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=bVfVjRdQTJ/xmgfP/Kwsk7sSbB8D334RyAW2q6PFS54=; b=IWRlPVpvV4CDxkspNPglF0lxROFeXlg9OPsEa0bGEOB0yMF19rEtV0hpVfxCfre0fP 3zuB56ytCaHAQ0Ir1pQOVzL25BTsh1G7rrRloD2o3qDIBRyHiuFRRu7L+ojY5JQa2YQU 0w/rSkCgle1w4M7spjg2FAUcM+0yqmvdvLzpC+fHMUIXbgeJLUZMeQgDvPqrB8xCIcSc UpetPnqqXlfpg045s0XEOeWIbAkKRcf4zeI83vk/rx7BzaxqPR1wRsrKvo05hsmlJO1D ifA9aV8lq2OIQyrQPSxxN6lxXzobp/GL6vmiVza9Le16saatmuIhioub0ZN2WdXEC4Gj HoiA== X-Gm-Message-State: APjAAAVTh0MxTuPoVBsgFtOO5nsqY06n4cZFtCQ71riLr18sltNhzFAw QBaADFygu2upHhEGv2Uo41k3dDnGbw8DRTJf9aM= X-Google-Smtp-Source: APXvYqySeDXKuAk/jceR6kLRX4r6E3BS3sd6Q3qwbtklbPdYpeWsdF0DbsBcyGh1hFYWHQih5bklcIhsigh/VPy9/Rc= X-Received: by 2002:a92:8897:: with SMTP id m23mr14818807ilh.36.1572222774493; Sun, 27 Oct 2019 17:32:54 -0700 (PDT) MIME-Version: 1.0 References: <9d3f9895-5ab6-1d75-4eb2-0ba93f13a8fe@gmail.com> <9D2698F0-49A4-4EA0-BEEE-552D28BE995A@newclarity.net> In-Reply-To: <9D2698F0-49A4-4EA0-BEEE-552D28BE995A@newclarity.net> Date: Mon, 28 Oct 2019 01:32:43 +0100 Message-ID: To: Mike Schinkel Cc: Rowan Tommins , PHP Internals Content-Type: multipart/alternative; boundary="000000000000fb47b90595eda3b0" X-Envelope-From: Subject: Re: [PHP-DEV] Optional pre-compiler for PHP8? From: benjamin.morel@gmail.com (Benjamin Morel) --000000000000fb47b90595eda3b0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable > > > So we'd probably need some built-in definition of a "package", which > could be analysed and compiled as one unit, and didn't rely on any run-ti= me > loading. > That idea of a "package" came up during a debate on this list at least > once, a few months ago, and I think it makes a lot of sense. And what I > proposed effectively implies that namespaces would be treated like packag= es > from the perspective of the compiler. Putting aside the idea of distributing pre-compiled PHP scripts, if we're only debating the precompilation as, notably, a means to reduce the cost of type checks, I wouldn't mind if the precompilation occurred *only if preloading is in use*, i.e if most class definitions are known on server startup, which is when the compilation / optimization passes could occur. No preloading =3D no such optimizations, I could personally live with that. No need for a package definition, IMO. =E2=80=94 Benjamin On Mon, 28 Oct 2019 at 00:56, Mike Schinkel wrote: > > On Oct 27, 2019, at 7:04 PM, Rowan Tommins > wrote: > > Thank you for your comments. > > > I chose the phrase "static analysis tool" deliberately, because I wante= d > to think about the minimum requirements for such a tool, rather than its > long-term possibilities. > > Your points are all well-considered. > > To be clear, I wasn't stating the idea as a alternative to your idea, I > was only stating that your comments inspired me to have the idea of a > pre-compiler. > > IOW, I saw no reason both could not be done, one sooner and the other > later. > > > However, combining those usefully may not be that easy. > > Also for clarity, I was not assuming existing OpCache would be 100% > unmodified, I was talking about benefits that a pre-compiler could have a= nd > was less focused on ensuring it could slot into an existing OpCache > implementation as-is. > > IOW, if it is worth doing it might be worth extending how the OpCache > works. > > > So we'd probably need some built-in definition of a "package", which > could be analysed and compiled as one unit, and didn't rely on any run-ti= me > loading. > > That idea of a "package" came up during a debate on this list at least > once, a few months ago, and I think it makes a lot of sense. And what I > proposed effectively implies that namespaces would be treated like packag= es > from the perspective of the compiler. > > But then again a new package concept might be needed in addition to > namespaces, I am not certain either way. > > > Unlike P++, Editions, or Strict Mode, this would undeniably define that > the deprecated features were "the wrong way". > > I am not sure I cam agree that it would define them as the "wrong way." > > The way I would see it is there would be a "strict way" and an "unstrict > way." If you prefer the simplicity of low strictness and do not need > more/better performance or the benefits of type-safety that are needed fo= r > building large applications, then the "right way" would still be the > "unstrict way." > > And the non-strict features would not be "deprecated" per-se, they would > instead be disallowed for the strict (compiled) way, but still allowed fo= r > the unstrict (interpreted) way. > > > If the engine had to support the feature anyway, > > I think we are talking two engines; one for compiling and another for > interpreting. They could probably share a lot of code, but I would think > it would still need to be two different engines. > > > I'm not sure what the advantage would be of tying it to "compiled vs > non-compiled", rather than opting in via a declare() statement or package > config. > > The advantage would be two-fold: > > 1. Backward compatibility > > 2. Allowing PHP to continue to meet the needs of new/less-skilled > programmers and/or people who want a more productive language for smaller > projects that do not need or want all the enterprisey type-safe features. > > Frankly it is this advantage which is the primary reason I though to send > a message to the list. The chance to have the benefit of strictness and > high performance for more advanced PHP developers while still having full > BC for existing code and for beginner developers seemed highly compelling > to me. > > -Mike > > --000000000000fb47b90595eda3b0--