Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113348 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 47428 invoked from network); 3 Mar 2021 15:37:32 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 3 Mar 2021 15:37:32 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 14D671804F6 for ; Wed, 3 Mar 2021 07:28:04 -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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-ej1-f47.google.com (mail-ej1-f47.google.com [209.85.218.47]) (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, 3 Mar 2021 07:28:03 -0800 (PST) Received: by mail-ej1-f47.google.com with SMTP id do6so43025218ejc.3 for ; Wed, 03 Mar 2021 07:28:03 -0800 (PST) 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=TtMufxRIe+Zw2mFN4vvqn71O0R6Kc35hct9RFWrrVpQ=; b=Id+BwcaQazRQrkZbtGk9v0mpKtJ42QJ8X6WN02DCjVNhLg7EMTW0TSJA23nS8QzT1Z sxi38GdQFCFiZ8JcBa4RvO8HGj3yESEZRspIXsYsXi/zHNUlI8I7e97SCnhRGbrQyE7a +tZouxpIq6Myt72GDvbuQpa8EQ0JBiSiuCdn8gRtMpRiyImAdC8wQ1ZrmngzQJiWd7Mv burBxXB4/RF6b4cFj9mO8o60BJYpmaWXFo4vh6mtJJM4PeM4c9e0+++uLbunVaw8v9Xu w6avHj1F8ajqa2lN3ZkeEEjydAiU6NyZb3jc4XpY6ZmK+cjR/m5nUEaQC1hhWzJ4YuZg t62A== 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=TtMufxRIe+Zw2mFN4vvqn71O0R6Kc35hct9RFWrrVpQ=; b=LmozOgpkw4n5ymSNZ+qMdckNglSrGl56vmejPYVuodORK49cUKyhuv4Uju4EeNu2lT xdJCuu7T5mlbe097PjASzds72tqZW2bU6iPmLntNm+3fxlys43bYRM7PSwZAPk2yvldo JR7lZc5OKjqRKf8OMGkg5zBO6wqhpRZkYytvasPod1E3JqOEPt3sLCeD++51PYu9TdXQ 2ZyGsH8a/gFHgY2Cld8KYl2OzAh3QXv205av7Jwo+6EVupMMo9ngPz1vQW/m9JY1KPEJ msL05ogKPMBhsIuwdqHWNFoCttTvGa0NWnG4UlXGO1cMehzb6LCJL1c5FpXtZWCBoT3c IdIw== X-Gm-Message-State: AOAM530xV6FBcrAMkjJYxoDaGS0KtU2c1/Uc5g6moUAMjEBHOx1yD+Y7 mUgjUKfB4h5E7P7aSo1xsg/35nOsL8xZkJAkKOE= X-Google-Smtp-Source: ABdhPJwFuzEt5KCnh+gAhCMbW2EEMrmprLPgWJmzoCSWA6zkLSl5ezV2jsuXZB8gT9GhKRiB4FvUZEsGiTOdhjajegk= X-Received: by 2002:a17:906:1ecc:: with SMTP id m12mr26291769ejj.4.1614785282470; Wed, 03 Mar 2021 07:28:02 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 3 Mar 2021 17:27:46 +0200 Message-ID: To: Nikita Popov Cc: PHP internals Content-Type: multipart/alternative; boundary="00000000000026755605bca37f98" Subject: Re: [PHP-DEV] [RFC] New in initializers From: drealecs@gmail.com (=?UTF-8?Q?Alexandru_P=C4=83tr=C4=83nescu?=) --00000000000026755605bca37f98 Content-Type: text/plain; charset="UTF-8" Hi, This looks very nice and I'm interested in further steps where not only new can be used :). The only thing I think it would be good to improve is to have a deterministic order for running initialization. Yes, this can be done at a later point, I guess. But maybe there is already an order of initialization right now and people would start replying on it and it would be good to mention it. Or maybe I didn't understand what this refers to: "this is not guaranteed behavior, and code should not rely on a specific point of evaluation." Also, in https://wiki.php.net/rfc/new_in_initializers#evaluation_of_expressions I think that for the static initialization the text should say "are evaluated once." instead of "are evaluated once per request." so we are more general, including CLI cases. I'm used with dynamic initialization coming from other languages, learning it in Java 13-14 years ago, including the clearly defined order of initialization. Regards, Alex On Wed, Mar 3, 2021 at 5:04 PM Nikita Popov wrote: > Hi internals, > > I would like to propose allowing the use of "new" inside various > initializer expressions: https://wiki.php.net/rfc/new_in_initializers > > In particular, this allows specifying object default values for properties > and parameters, and allows the use of objects as attribute arguments. > > The RFC is narrow in scope in that it only adds support for "new". An > extension to other call kinds should be straightforward though. > > Regards, > Nikita > --00000000000026755605bca37f98--