Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:119722 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 85590 invoked from network); 16 Mar 2023 11:51:18 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 16 Mar 2023 11:51:18 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 0140518037E for ; Thu, 16 Mar 2023 04:51:18 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_20,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE 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-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 16 Mar 2023 04:51:17 -0700 (PDT) Received: by mail-pl1-f178.google.com with SMTP id bc12so826649plb.0 for ; Thu, 16 Mar 2023 04:51:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678967476; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=F/YFQxg3651QyTSTjLEGuvAOFGxUTxfbvD7i4euYmew=; b=nY4vZhr19j6nHr/XY1XkyLrsu64glGfCYZZHiHgljw6Be6iQ3rv1uFNtg0mOZe7zhr 3+pxkX1aXlKKUxCTb2EVFMx0ANO4Wnt2gNPIWpFgLsDS8ZxKQNmRC7J6FtIGAYdzaMP3 KlJaZr9HGqwrkuYusU1Y31ZYZcqHbMRnlHi3Inf32P3+VGXHIUuJC6n+EY9nCWFS28Oj +P+WBx4RdS3vRYdpQcRdfHXkksuQ/LMVRnT+0350poGNGFzR1FAbbeDmcF0qnJa1znpR bupGLZTg4L1VAJYC5Ev2cydLbi1ANFxiZ/DTcHthPDh5LG6jPFWrTXu7GDyFg30Wvys6 l0tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678967476; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=F/YFQxg3651QyTSTjLEGuvAOFGxUTxfbvD7i4euYmew=; b=W8dYIbRPUWLpl/h7z4RbtnLDC5EvcGRGkYyrjEd3dtjb+5JqZhd4JqcgaqVb0OTtCC N7TwI27QrjHDVUtOwfcQmrEASj2iwMnsg/QqJ67PqoCFsSLVPpJ1I+N99erXotU7tH7w 94rHEdb6+tgx9aPOkT0PyETMjh/9NyofftWSKW6YzqHwsbCo8csPjYnyrkfpCURLUWFq iAkAW/RdLx4sQfi+V+aQohFzMoEw0z+YWvEitf/YgtSspUqbbFgy/belv2NioI/qN4cO z/Q+0JYtexmYG91odzi+00mtpKs4i1CM/NHPbZkFzoTmsdY35BeBne0R8zLuUpTxRUMO xd6A== X-Gm-Message-State: AO0yUKW/Wp+Bena0js8ljJ9bKxwqaUSRjkvIqSr6d0Sz2d3lHnMXePwe e9ds77DkSnLrPNuvHBa0DB2k1qL5KosjqaszSAJop2dk X-Google-Smtp-Source: AK7set9YDLOcVq/x3Wrrrfep491rWHo43Io8g0GDeTcb/+cBXSZddxJjdJdftiegnMa+NsZlNde0CN8H9tm287NsWD0= X-Received: by 2002:a17:90a:d3cf:b0:234:ac9c:5daf with SMTP id d15-20020a17090ad3cf00b00234ac9c5dafmr1081409pjw.2.1678967475992; Thu, 16 Mar 2023 04:51:15 -0700 (PDT) MIME-Version: 1.0 References: <57ed96c2-0547-c905-1c6f-7433ecb4a1b5@bastelstu.be> <684c1457-16e1-1cf2-b005-b273ff7e4929@bastelstu.be> In-Reply-To: <684c1457-16e1-1cf2-b005-b273ff7e4929@bastelstu.be> Date: Thu, 16 Mar 2023 12:51:05 +0100 Message-ID: To: PHP internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] [RFC][Vote announcement] Arbitrary static variable initializers From: tovilo.ilija@gmail.com (Ilija Tovilo) Hi Tim > Using Alain's example of static variables that depend on each other. For > the following: > > function foo() { > static $a = 0; > static $b = $a + 1; > } > > The value of '$a' is known at compile time. Is the value of '$b' also > known at compile time? It might make sense to include that as an > explicit example in the RFC (examples are cheap). Interesting thought. $a's initial value is known at compile time, but $b's isn't because it doesn't depend on $a's runtime value by the time it reaches $b's initialization. This value could change between $a and $b's initialization through direct assignment, by-ref modification, or even access by-name which is not easily detectable. I've added a section to the RFC to explain how this works in more detail. https://wiki.php.net/rfc/arbitrary_static_variable_initializers#what_initializers_are_known_at_compile-time Let me know if anything is still unclear. Ilija