Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123292 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id 02DFE1ADA7A for ; Thu, 9 May 2024 15:26:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1715268443; bh=7aLJACi5fVWnmQ/uI8m4r66dUmZOMXx9Ni7jnzuXdC4=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=YX5q9Ao6NFIbae0O1fN1PHFlAbAvtCu3+v0Fs05ax8x1s0yMNhyLWGicdc81jGANN wMoDKwc4JPnNSKBf8Yug+3xDQALe45w50VKZCifdwdCeYxTqtFEErjqBq8l9KUSTtT XBWbEThOfI7yzMaSunTtxT+U5R+w4dS3D1iRHMvP9gobEKlupRIyoa9IoOXgI5+Gzm mzJJvpKGyUPXndfvbrP7FfL795Ynp7coxCJrJUv5f0g97jTnTZXVRSnAMuyiZ8xUoF Sq/00w4unpPBBNFrFgNcAm75CJp35c4OLAEP1rpZ+lpKy+/n6BT2/o7XoBZl4jFVaY Bd8kXKquy5x0A== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id C2FA4180340 for ; Thu, 9 May 2024 15:27:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: ** X-Spam-Status: No, score=2.1 required=5.0 tests=BAYES_50,BODY_8BITS, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS, FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 9 May 2024 15:27:18 +0000 (UTC) Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-41dc9c83e57so11857505e9.0 for ; Thu, 09 May 2024 08:26:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715268388; x=1715873188; darn=lists.php.net; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=7aLJACi5fVWnmQ/uI8m4r66dUmZOMXx9Ni7jnzuXdC4=; b=Zsu87Dmu2Hm8jClQuMq6NxDWVdOKmoz3H3iwCQ6z7JdQ7/3JQsU760bldGL/gIDoBt fDauscaR/yfW2V7sblqwSL0tlkkulfZRnaWXXFIoBlxJXC1D5zT07FmwHs3lrPRqIWCX oh15rZw0uxCSbqvdJMHBevVA7fbMDV7PqXkRsW1uQC4E/6HceXMqba+byExsFXKnnoV6 bgfeTwxbDVaKSgbJJ6/8l/E1TKuzwL7BhSa3k0TB/cDgtQ60oeeeDHSYn8Yn/iRIuCFK 9xKt6KVDSOk9+OAwOCZMr812vpanhJD8f3XOBv/8bpR2bkf2sLfehPR/2W4gsJWwqrwg 1abQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715268388; x=1715873188; h=cc: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=7aLJACi5fVWnmQ/uI8m4r66dUmZOMXx9Ni7jnzuXdC4=; b=n7d5sBKbUJr4gFFtnW2hevoWJUcrKGpkd8eb9a31xOF3u5hFAllaLUV0elrIrKO4ft JqO3EG5wEiwSx/I5xD5+VXVCPkh/fU1O1efq6jXrOxd2wvb1KPUQYtCUykD59kgkmm9m n53PPFz5RRgvvk8KUAs6wSiXNIqYQ0dXaqJYOIe81N15RBqrKapq+02W7fYU1AIMbl91 II3ZUHhpJem4qI+KYNoJ++GcXmQtBdV5P0YhQbPkBe0SdoTKh2pwAIqh7BvDmR+7c7we 8Sf3axzI6iiiaSwXw7LBhVX7mAhtQnHhNkp+xPLbQa48KkRQkjWvTlVOig4BYPg59EJg mh8A== X-Forwarded-Encrypted: i=1; AJvYcCUOjkdzcKEgkTWh8eDP8O7WqNYBjiofr1Drugt9DOorkSfMG458O4ZXPwM3t/l9HjO6tYp5nPKZdAeS7GltudHX0Hu2ZrYCCA== X-Gm-Message-State: AOJu0YzzWCUwqusMHcwxIWLcBTspywS1tXa36QCFkDA8ryhmhEm/1VBU pLjq0/XNPuRjaRxY4Wh30kn6hz6Q7WU0+TWzHHbVinO36lfIdFNBoyzMASlGYzcCwLorXmmBwtP 5LX1jleACqjwuyHxejr5N2T0e1w== X-Google-Smtp-Source: AGHT+IHP/TUIcHFPgfZCaI+6qsOYcI3FTYY9JhQg2wPDt1aXy6IIyEmhf6yFcDLXa1LvlkVZoZdcFNL5q1zVXDVjv8I= X-Received: by 2002:a05:600c:1c95:b0:41a:8035:af77 with SMTP id 5b1f17b1804b1-41fbcb557aemr26548605e9.12.1715268388195; Thu, 09 May 2024 08:26:28 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 References: <0466054f-bbec-47fd-8452-e848ebec7ec9@app.fastmail.com> In-Reply-To: Date: Thu, 9 May 2024 18:26:16 +0300 Message-ID: Subject: Re: [PHP-DEV] [RFC] [Discussion] new MyClass()->method() without parentheses To: =?UTF-8?Q?Alexandru_P=C4=83tr=C4=83nescu?= Cc: Robert Landers , Larry Garfield , php internals Content-Type: multipart/alternative; boundary="000000000000f917860618070a28" From: udaltsov.valentin@gmail.com (Valentin Udaltsov) --000000000000f917860618070a28 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable @Lynn, @Alex, thank you for your comments. I have improved the "without constructor arguments' parentheses" part of the introduction section and started the voting. =D0=B2=D1=82, 23 =D0=B0=D0=BF=D1=80. 2024=E2=80=AF=D0=B3. =D0=B2 16:55, Ale= xandru P=C4=83tr=C4=83nescu : > > On Tue, Apr 23, 2024 at 3:31=E2=80=AFPM Robert Landers > wrote: > >> On Tue, Apr 23, 2024 at 11:10=E2=80=AFAM Valentin Udaltsov >> wrote: >> > >> > >> > Does anyone have additional feedback? I'd like to start voting on >> Thursday, April 25th. >> > I've also added a section on other syntax ideas that have been >> expressed on Twitter and in the PR: >> https://wiki.php.net/rfc/new_without_parentheses#other_syntax_ideas >> > -- >> > Valentin >> >> I suspect this will break (badly written) reflection in interesting ways= : >> >> https://3v4l.org/mcSNH >> >> This basically breaks dereferencing order of operations and makes it >> inconsistent. >> > > Quote from RFC: > "RFC still does not allow to omit parentheses around the new expression > *without* constructor arguments' parentheses, because in some cases this > leads to an ambiguity" > > And actually it mentions a list in the RFC: > > // Instantiate and then access the instance or instantiate the result of = the expression?new MyClass::CONSTANT ;new MyCl= ass::$staticProperty;new $myClass::CONSTANT ;n= ew $myClass::$staticProperty;new $myClass->property;new $myClass->method(); > > But actually from all of those, right now, only "new MyClass::CONSTANT > ;" and "*new* $myClass::CONSTANT > ;" are not working, while the other 4 are > working fine. > > So yeah, this needs clarification if they continue to work as they work > right now: > https://3v4l.org/PmCfR > > Thanks, > Alex > --=20 =D0=A1 =D1=83=D0=B2=D0=B0=D0=B6=D0=B5=D0=BD=D0=B8=D0=B5=D0=BC, =D0=92=D0=B0= =D0=BB=D0=B5=D0=BD=D1=82=D0=B8=D0=BD --000000000000f917860618070a28 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
@Lynn,=C2=A0@Alex, thank you for your comments. I have imp= roved the "without constructor arguments' parentheses" part o= f the introduction section and started the voting.

=D0=B2=D1=82, 23 =D0=B0=D0= =BF=D1=80. 2024=E2=80=AF=D0=B3. =D0=B2 16:55, Alexandru P=C4=83tr=C4=83nesc= u <drealecs@gmai= l.com>:
<= div dir=3D"ltr">

On Tue, Apr 23,= 2024 at 3:31=E2=80=AFPM Robert Landers <landers.robert@gmail.com> wrote:
<= /div>
On Tue, Apr 23, 2024 at 11:10=E2=80=AFAM Valentin Udaltsov
<udalts= ov.valentin@gmail.com> wrote:
>
>
> Does anyone have additional feedback? I'd like to start voting on = Thursday, April 25th.
> I've also added a section on other syntax ideas that have been exp= ressed on Twitter and in the PR: = https://wiki.php.net/rfc/new_without_parentheses#other_syntax_ideas
> --
> Valentin

I suspect this will break (badly written) reflection in interesting ways:
htt= ps://3v4l.org/mcSNH

This basically breaks dereferencing order of operations and makes it
inconsistent.

Quote from RFC:
"RFC= =C2=A0still does not allow to omit parentheses around the=C2=A0new=C2=A0expression=C2= =A0without=C2=A0constructor argu= ments' parentheses, because in some cases this leads to an ambiguity&qu= ot;

=
And actually it mentions a list in the RFC= :
// Instantiate and then acces=
s the instance or instantiate the result of the expression?
new=
 MyClass::CONSTANT;
new=
 MyClass::$staticProperty;
new=
 $myClass::CONSTANT;
new=
 $myClass::$sta=
ticProperty;
new=
 $myClass->prop=
erty;
new=
 $myClass->meth=
od();
But actually = from all of those, right now, only=C2=A0"new MyClass::CONSTANT;"=C2=A0and "new $myClass::CONSTANT;" are = not working, while the other=C2=A04 are working fine.

So yeah, this needs clarificatio= n if they continue to work as they work right now:

Thanks,
Alex


--
=D0=A1 =D1=83=D0=B2=D0=B0=D0=B6=D0=B5=D0=BD=D0=B8=D0= =B5=D0=BC, =D0=92=D0=B0=D0=BB=D0=B5=D0=BD=D1=82=D0=B8=D0=BD
--000000000000f917860618070a28--