Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108042 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 62472 invoked from network); 9 Jan 2020 00:44:56 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 9 Jan 2020 00:44:56 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 010CB1804F3 for ; Wed, 8 Jan 2020 14:50:25 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-yb1-f180.google.com (mail-yb1-f180.google.com [209.85.219.180]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 8 Jan 2020 14:50:23 -0800 (PST) Received: by mail-yb1-f180.google.com with SMTP id c13so2216555ybq.5 for ; Wed, 08 Jan 2020 14:50:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=newclarity-net.20150623.gappssmtp.com; s=20150623; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=JDFebj02OPUNbD3zzj5rmQXVMBd3MWkD03OAtWbMPcM=; b=TCCaLtMnltyaQ+UUQLAezh7CW/LbL6k4EEuVFLbNS4Rzp6/gi9TLv7ZL2LaT9izWyf LyNpDu/IrvqIkQ/cgG3a0Ykt/kSjL4m8ZRXob2s2nSZoMyfr4wVUnWADdXch3WelaZ1k ts7Hv8Rf1PuU0H6i1fxAo3neKVJxF3mCCjuDkoIqDQKI8mT9oM7to3/wKdJiFfoIsaPL mU57j+2dL6RQtrFQzQQmm86lQXlgtqNOt8VqJ5RNcRb5JmIZxqVZqUe3PmyJ9GeWHULW ayy30QyA0NOQVnqArnH/PhfXv4dMiVKigEEntMuv98+GGzuJ/k8RW3YiavxIM8sZpHhV XoiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=JDFebj02OPUNbD3zzj5rmQXVMBd3MWkD03OAtWbMPcM=; b=VV25oWt2ZRtmCYi0SwnFuU7EavjLg9iQvE+FI7u5NZ/IiHHa3HRYqEy4Xm31OKKm1D /YdB4lKIgkKWckOZebBkKSaEWmJx4E+tqewSXvxdDSY/xGRqgYjZO4WPsel0qvw1lXJP 2SFAGAHoJQh5wXAhNyGdLuPwhNYCEResTdbssskPgf24R5bgBSrx1BIE18B+Q+7sDzyK zTCGqbY91jifzMrvIbYl94A8Uxc5n3Ubb7kq4k/noTsck6thGwFj3LP0SCSjkB2rflJf h7S148t5YTxan9BqZbz5smT96HLFpEvJw+IuHkyieVQ557WtiZCBg6/FuTjXz+SwvNmx tdNw== X-Gm-Message-State: APjAAAUf+iJKEZjUXRs9FTrNGJypZCu4Xk6bZuANiIpAdQmRFCcCegQ9 shoBH42MsCdv8RmypdVsFFGPlw== X-Google-Smtp-Source: APXvYqwrFH56+jug73QdyP1TiGTL4+yqco/gm1tf+8yc2L4gQZ6lLUSkS3qkyDHXWp/w28XASBNO+Q== X-Received: by 2002:a25:1f82:: with SMTP id f124mr5856226ybf.471.1578523822093; Wed, 08 Jan 2020 14:50:22 -0800 (PST) Received: from ?IPv6:2601:c0:c680:5cc0:6036:2cc1:2752:4a78? ([2601:c0:c680:5cc0:6036:2cc1:2752:4a78]) by smtp.gmail.com with ESMTPSA id t5sm2117687ywc.3.2020.01.08.14.50.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Jan 2020 14:50:20 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) In-Reply-To: <5455D4D6-9B07-4957-BA98-489EE12FEDD8@newclarity.net> Date: Wed, 8 Jan 2020 17:50:19 -0500 Cc: Rowan Tommins , PHP internals Content-Transfer-Encoding: quoted-printable Message-ID: References: <5e0d723f.1c69fb81.e2ae8.24e2SMTPIN_ADDED_MISSING@mx.google.com> <74F2DBFC-E63C-428C-A37F-2D0CEE15AD0F@newclarity.net> <53556dfb-44ce-f902-204c-9a7da9484a61@gmail.com> <65567C7C-CF0F-4562-8943-F1F302134B07@newclarity.net> <6f20bda1-eff6-631d-915f-d6bb149ee666@gmail.com> <93BA4B49-9D9A-4A41-83B3-8EC2564A70BF@newclarity.net> <5455D4D6-9B07-4957-BA98-489EE12FEDD8@newclarity.net> To: Robert Hickman X-Mailer: Apple Mail (2.3445.104.11) Subject: Re: [PHP-DEV] Initializing constants once, with code? From: mike@newclarity.net (Mike Schinkel) > On Jan 8, 2020, at 4:25 PM, Mike Schinkel wrote: >=20 >> On Jan 8, 2020, at 11:10 AM, Robert Hickman = wrote: >>=20 >> My suggestion was not a preprocessor, but what others have said >> already, a 'shim' that goes between the parser/lexer and bytecode >> generation which allows user code to inspect and modify the AST. This >> idea is not unusual and Python for example can do this. The idea is >> the basis of macro systems in Lisps, and Rust has a very nice >> implementation of it from what I've seen in passing. The system = should >> be fully aware of the syntax, scoping, namespaces etc, the lack of >> which is the problem with C preprocessor for example. >>=20 >> With regards to how JAI does this: >>=20 >> https://www.youtube.com/watch?v=3DUTqZNujQOlA >> = https://www.youtube.com/watch?v=3D59lKAlb6cRg&list=3DPLmV5I2fxaiCKfxMBrNsU= 1kgKJXD3PkyxO&index=3D20&t=3D0s >=20 > Nice! =20 I replied prematurely. =20 OMG, JAI's ability to run code at _compile time_ is incredible, and = exactly the kind of thing would solve the concerns about dynamic = instantiation of constants. It would also solve a large class of performance concerns, way beyond = just dynamic instantiation of constants, as well as allow us to = implement really robust error checking assertions into our libraries. Which makes me wonder the following: AFAIK PHP opcodes are not something = a developer can handle; they are only handled by PHP itself. IOW =E2=80=94 correct me if I am wrong =E2=80=94 but PHP _cannot_ = generate an OpCode file to disk that can be named and later loaded by a = different PHP app? The only thing similar to this is PHAR, which AFAIK = is not OpCode, right? If not, how about we discuss about creating a full API to allow = developers to compile to OpCode files and then load and run them? In = addition to exploring this run PHP code to generate OpCode before the = page load actually runs? -Mike=