Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:107722 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 78505 invoked from network); 28 Oct 2019 12:13:40 -0000 Received: from unknown (HELO php-smtp3.php.net) (208.43.231.12) by pb1.pair.com with SMTP; 28 Oct 2019 12:13:40 -0000 Received: from php-smtp3.php.net (localhost [127.0.0.1]) by php-smtp3.php.net (Postfix) with ESMTP id 2845C2CA32B for ; Mon, 28 Oct 2019 03:01:03 -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-x134.google.com (mail-il1-x134.google.com [IPv6:2607:f8b0:4864:20::134]) (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 ; Mon, 28 Oct 2019 03:01:02 -0700 (PDT) Received: by mail-il1-x134.google.com with SMTP id y5so7647915ilb.5 for ; Mon, 28 Oct 2019 03:01:02 -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; bh=1R3RnIbr1VkJMRIVuN+aHbhqrL6fBqVD23yNr6qbgTk=; b=Abx5jMO6F+/AaAtjTj3qYZ4K/AnohQrhkcdqHfoJ+k9ZPAcxwfRujgS4reZHGSIIi1 IOPKFBysrDMIrxLJFoK7+OPpJr8HzsVIXdOyNGsAUj8Tqg3INDO2PL84qvcHtsLJ4OTu F5ZQ46gyfJM2TUSkuOyC6T79q0eF+LfTMSVxtq1gxCR7y77zKfAvnBx7wBAmEWzYrgnA VbzZbcEnL+H8M7f4VIhsisMjap3hJUwUSCMZIRlWKt/Wiw9ZtRyP5BMXtAwigJF4LTHM zH3NyXnptDQ3Edxycv8RqcS0Zk9c/wjFbA05jmk0KkuXtMEq/abZamDz/6QM38uLF1jz Q5Mg== 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; bh=1R3RnIbr1VkJMRIVuN+aHbhqrL6fBqVD23yNr6qbgTk=; b=eQe2NI1N/W8/a986XpXpLs6fx8jjgzn4EeRt67Dnd+j1g69DIG5jHS0mdfZBjEZro/ RefkvIOkAzJ3ItoUxCoJIvxriRTAJu6mLLGLNYmeSFQQY2++5qiUcOdQ1raahq0f9ZhO dljBpxNBqPUf9uvjSR/WYozB+NCOpt5EclYtuGsn9ocATcIugQMGX2EWyWyJ2B6+rHCI FyZ2jdcrRT6yW5U9X9A8nFLglooayKghDI3XuevtmVmGhbR9XPtJtOkNOas6yS/AySv5 Ox4z8dEQ3hzw5wT1BHbarV5AdCnnuBmkVENtWolS5gjqtIn3+TEm18f+qtSAWj+VfoE5 3USQ== X-Gm-Message-State: APjAAAWbkRSQNpE4slL/8usFguBDZN+0zb95mD+IwdBiP+hgjEWdB1b5 4pI1n05XBHfMaKlDd0wxYEZm46KpSeAYbqe55wzs4g== X-Google-Smtp-Source: APXvYqxIsMnBRpfAQxLJhTzRzrse3vwvgkhogkPjTlTkGWQxcfiLZhs+VyXqF1Wx5Jt2SCBrCaZZm7Pxir3i30H8a90= X-Received: by 2002:a92:46d9:: with SMTP id d86mr17529018ilk.253.1572256861867; Mon, 28 Oct 2019 03:01:01 -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 10:00:50 +0000 Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary="000000000000bf55620595f593ee" X-Envelope-From: Subject: Re: [PHP-DEV] Optional pre-compiler for PHP8? From: rowan.collins@gmail.com (Rowan Tommins) --000000000000bf55620595f593ee Content-Type: text/plain; charset="UTF-8" On Sun, 27 Oct 2019 at 23:56, Mike Schinkel wrote: > > 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-time > 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 packages > 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. > > Current tools tend to actually work on a directory level, because you don't actually know what namespaces are involved until after you've loaded it, and a file can include code for two completely separate namespaces. My thinking was that a package would pre-define the full list of files that define it, with no auto-loader, and no conditional definitions evaluated at run-time. As Benjamin points out, this is closely related to preloading. > 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 for > building large applications, then the "right way" would still be the > "unstrict way." > > And what if you want simplicity *and* performance? Most of the things people want to make strict about the language don't make it faster, so if we limited "pre-compiled mode" to be strict, we'd be making a deliberate choice to group objectively good things (fast vs slow) with subjective preferences (strict vs simple). That pretty clearly marks strict mode as "the better 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. > > That sounds like the worst kind of fork: two different engines, running two different dialects of the language. At that point, you might as well just switch to Hack. Note that this was exactly what "P++" was intended to avoid - the two dialects would exist in the same engine, and get the same performance and security enhancements. > 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. > > Both of these are reasons to have some sort of "strict mode", but not for tying it to some other feature. Regards, -- Rowan Tommins [IMSoP] --000000000000bf55620595f593ee--