Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113361 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 8583 invoked from network); 4 Mar 2021 05:30:59 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 4 Mar 2021 05:30:59 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id E7C5A1804D3 for ; Wed, 3 Mar 2021 21:21:38 -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-il1-f178.google.com (mail-il1-f178.google.com [209.85.166.178]) (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 21:21:38 -0800 (PST) Received: by mail-il1-f178.google.com with SMTP id v8so20060005ilh.12 for ; Wed, 03 Mar 2021 21:21:38 -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=WVKYRUDGzpsB3RPkirEsfaiYCPnZXBzC3NwbxY+142Y=; b=Pv0FyR5vHdlHRpnI7S5V8pawsGpv9qXtxT2uUysYZYnKubfUW544h4yWCSiapGmDtu ZgdqVLz9iVxVpLr6BUsmwQ79yvsbFaGEUtrySdunX+aor3WK3dkSRI1n6O+kktbNUKkZ A4VJoLl8GwxC/kOm86DUEeGWyaxcNzcsW1oiEKBZ9/EGQlEktWDUZHmstgn3rrb3TKL3 S6/BvrdedqEygxnS/0oq8nm0QBNLYi3GtCv621Nx+OdvOj+dBIPmiKs3qeTSinZHUHyI 6ECNCeoP18EQml8B1t4YcS70bGFquiVwWERycbkusAcet95kv3kcKwseAy/EV6fdcGfS OgLg== 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=WVKYRUDGzpsB3RPkirEsfaiYCPnZXBzC3NwbxY+142Y=; b=m9EGjZPv4Gju40IR5s5M5GijFnH3pxoAjIf1fVfjlnSXQIFhfbGmKuKDvBNSXnaj1P KiMpp6Q+8lNPWfpVwSiUtyPaN2LtoNxYnPu2Ul4Gz14brrwfamT1hzvr3bkkooZMmMms hajF066GzNbKr3L3U1k5qXXHhbcDltIATSmabIYTbJosuZgWAVgT6X3o8tBNIowbhUds lOqPhnxRoQQNAwHpIT/EiPDlvFhnwz2eH/aU0yE7YMAoeeLnoNDVunzNmqZ5bsdwIj91 NAIJWsGW6KARRepXN6wenH7G0mQcRtYRiZUGSCcgrhKIWkmsdM8JtbyXEymxXel4jtV1 vwZQ== X-Gm-Message-State: AOAM530nbvUzl8BA6jTI90bZBHJ0AhKPuMFTcxkRo0zi9oR5cTOHQ2A5 bm2Nmp63zF1788RpdGcwZ38iZPojTbnUIbXW0rM= X-Google-Smtp-Source: ABdhPJz6fo1rnqBhGweiEBiSPktSlwVNKe/tyOZrjDqiWDGQ9em9wnG1UP9mgPeb5OxYJyUDpCj9qCvDe0NUEsDQizg= X-Received: by 2002:a92:3647:: with SMTP id d7mr2759550ilf.264.1614835297601; Wed, 03 Mar 2021 21:21:37 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Thu, 4 Mar 2021 06:21:24 +0100 Message-ID: To: Nikita Popov Cc: PHP internals Content-Type: multipart/alternative; boundary="00000000000048ce7905bcaf2497" Subject: Re: [PHP-DEV] [RFC] New in initializers From: michal.brzuchalski@gmail.com (=?UTF-8?Q?Micha=C5=82_Marcin_Brzuchalski?=) --00000000000048ce7905bcaf2497 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Nikita, =C5=9Br., 3 mar 2021, 16:04 u=C5=BCytkownik Nikita Popov napisa=C5=82: > 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 propertie= s > 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. > The reflection mechanism for properties, constants and parameters is not described in RFC but I do believe it should for constants part. Correct me if I'm wrong there. The reflection for ReflectionProperty::getDefaultValue the same for ReflectionParameter is similar and I get that it possibly should evaluate the value on each call. But what about constants which by their nature don't change? Does that mean that each time ReflectionClass::getConstant is called the value is already evaluated and the return value always refer to the same object instance. Is that right? I guess it is. IMO it deserves to be described in the RFC. In general I love the proposal was especially thinking of it for static variables. Cheers, Micha=C5=82 Marcin Brzuchalski > --00000000000048ce7905bcaf2497--