Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:117954 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 35163 invoked from network); 15 Jun 2022 15:16:50 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 15 Jun 2022 15:16:50 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 7C8AE180538 for ; Wed, 15 Jun 2022 10:04:36 -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=-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_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-ej1-f42.google.com (mail-ej1-f42.google.com [209.85.218.42]) (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 ; Wed, 15 Jun 2022 10:04:36 -0700 (PDT) Received: by mail-ej1-f42.google.com with SMTP id y19so24496490ejq.6 for ; Wed, 15 Jun 2022 10:04:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=dZjYI9D623PwoxL3EzM3bEOlf3+gRQRJRkiEZyFEz28=; b=fkNbEu7TFGzm46+jtabpUPiNor9vAbIRdrvDqeCyt/iplkFB1UnESkuBrJURXxq7Bm gA/sSFDYxlAIidJSZzCDpfKXOgLVHjkg46izZFmjba4Tl14VM6u0nEv+JcR2lHVrQmBR /PyIv5UXHn+M8QjdnpiDKokSNieWCKdyFhPl5jyw1C/8Ub5OqF6oCBKfdwq2nhHuFuQE aZgw3jvS3pcAUM6Yg5v4+jvS11apbgALvAxeV7BzASz5LcW+Zrtp7SCpMfsCzxFOoekl EDKKDATJGQVIh9YaYV89x5Q9BR+MSt0Cb6tQ6MKzzN0/SWnjygR0bLZ5kZZBlTHwTHfA 3Rlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=dZjYI9D623PwoxL3EzM3bEOlf3+gRQRJRkiEZyFEz28=; b=VFIl4Vgv2DyqtVgVmTTNBtQayVw6HGrB7J5zhz5SUUjiq82OmYPjRsPHSgq2+y28m9 nqR3eVR/5ZMzn8qALf+oGu4ruDEU5dhgM9GUA4t4SPZkIxqoDTeHclrty3PGrgq9jQx/ zo48Gh3Np0mKz6dFAJY24ZwTUDbZAlzlk5Ut4v15NsjZJRSSEjT0n+NY6ti42hkEC6dz xXnGFa1RybemTACROY0FyGP0UeG1BwgD7sJPhApjVIHhnFxMoHZ91XBatxvcpK9ICkuM BJ5NWPTJxufKmCFCGcO0mYfGzP+3ti86lT+pAKTbFsU7FXzDv4mobncWN+dcYRBwgdJm rMqg== X-Gm-Message-State: AJIora/rqji7IwZndlTaAfLkvzhTv+uN6TSMowzt2Y4j97R5P/6zHiyU 0BARbcQ1rHCjBTa8/mD/wKa+HE/Slrqk1gIe8m/0u/MweQaqaw== X-Google-Smtp-Source: AGRyM1vtRSchDZYg28jdztz7CqOtERHLv/CzEDCfw1jMNHoTs03RnERyVq//2AbaVaIHd5FM1mpWpUVPt1/zM6XKvZs= X-Received: by 2002:a17:906:af0d:b0:708:d48a:271 with SMTP id lx13-20020a170906af0d00b00708d48a0271mr695731ejb.329.1655312674759; Wed, 15 Jun 2022 10:04:34 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 15 Jun 2022 20:04:18 +0300 Message-ID: To: Ilija Tovilo Cc: PHP internals Content-Type: multipart/alternative; boundary="000000000000f8ab4f05e17f8383" Subject: Re: [PHP-DEV] [RFC][Under discussion] Fetch properties in const expressions From: drealecs@gmail.com (=?UTF-8?Q?Alexandru_P=C4=83tr=C4=83nescu?=) --000000000000f8ab4f05e17f8383 Content-Type: text/plain; charset="UTF-8" On Wed, Jun 15, 2022 at 6:59 PM Ilija Tovilo wrote: > Hi > > > Just a question. > > Would this also be allowed? > > > > https://3v4l.org/RGdIA > > > > > class A {public int $i = 42;} > > const BARE_CONSTANT = new A; > > class B { > > const ClassConstant = BARE_CONSTANT; > > } > > class C { > > const ClassConstantViaPropertyFetching1 = BARE_CONSTANT->i; > > const ClassConstantViaPropertyFetching2 = B::ClassConstant->i; > > } > > Yes, that would work fine. > > Ilija > > Hey, sorry to bump here on this topic. My assumption was that the use of `->` in initializers would bear the same limitations as using `new`. That would mean it would not be supported for - class constant initializers - instance property initializers - static property initializers For `new` clarifications are here: https://wiki.php.net/rfc/new_in_initializers#unsupported_positions My assumption is that `->` would only work for: - static variable initializers - global constant initializers - parameter default values - attribute arguments The examples shared by Shinji are for class constant initializers in class C and I'm guessing it would not work. If that's the case, I think we should clarify this in the RFC as well. Regards, Alex --000000000000f8ab4f05e17f8383--