Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113957 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 79819 invoked from network); 5 Apr 2021 17:20:50 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 5 Apr 2021 17:20:50 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 59EB71804B2 for ; Mon, 5 Apr 2021 10:19:39 -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,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-io1-f51.google.com (mail-io1-f51.google.com [209.85.166.51]) (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 ; Mon, 5 Apr 2021 10:19:38 -0700 (PDT) Received: by mail-io1-f51.google.com with SMTP id v26so12647239iox.11 for ; Mon, 05 Apr 2021 10:19:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=benramsey.com; s=google; h=from:mime-version:subject:date:references:to:in-reply-to:message-id; bh=rBj5QXnDt0TIhuJgdA1jMg7iOgXhi0ItgvBPJL9WqWk=; b=GOXrq39VypsTfegxjygxVtXtTUjqQddjj/LIZzXtLNWg+I9LfUVvS6zWvKMAy2nQT3 u0Bb3SsSUFcfb/jqVZRXbxRzNqOl4DhJXw+FC6iUaGkXzgZ4Niy3b1bfL+/hZsdugpR2 3QpHI8T0/QsA/fO80GktoJV2zoxbfMmlmLPUaankPyAYd5WqIrrGPEqodNbhdhvnGPJH 7GlsFqL7D3qNXcQXTWCD/Q4CWS1KUTilAtHo1WEWsv7zqPMwDLQHWttiy1Ek8bMLNPWO W+KOIBbcXfvzGj3gjemI8z64l49/zi84CjtfHNBNVwhZHv8IDlyiVaOeymIWbks0Qvoj srsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:mime-version:subject:date:references:to :in-reply-to:message-id; bh=rBj5QXnDt0TIhuJgdA1jMg7iOgXhi0ItgvBPJL9WqWk=; b=OPpPLcsoLkVi6PwOhQL7JngEqAacaRUvv7MUXxsJpjIGct8/vS+oPGwCEvuDDCThCc ndv43OtlMdtavVExnAA+Tojx1XIIVXklQ2uYB2DRFFjMwvQdpmhvFR8cPRS5R6h46jqM miRIb5PT7t7MifvUibu4nuk0tp8NN8nGSPPGn0yHH4s7vCinYPIzFkTyfykAjk6b9s+W DQbIT1Dk1kLOCElXVGM3fBPPLRcUYLaN2kHWIGaMZNtbRU/chlRZ4d0jc3S9Hn0nl9VZ iO7Hfz6GEUZ10hZUemkNufzTZsfY1n8ANBgtJP6MOn5s2SN+3aoskmzXVINSNeVwdxy7 GkyA== X-Gm-Message-State: AOAM533YN2WUjdjOgFtnoW2rQkb6k979htKkniohbOmjSk2kh8riGoqI iDHdze4Qsks1nPZSsQUwpMSvmCMKKIA9+miS X-Google-Smtp-Source: ABdhPJxCb5pvW+BZEsKbV045negzhGplHBcQ1N9rc36dgX9jAxZcDXFRdmn8gApYHCsjRORQecNlSg== X-Received: by 2002:a5e:990f:: with SMTP id t15mr19740466ioj.180.1617643177011; Mon, 05 Apr 2021 10:19:37 -0700 (PDT) Received: from [10.10.42.56] ([96.61.105.82]) by smtp.gmail.com with ESMTPSA id q8sm11078336ilv.55.2021.04.05.10.19.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Apr 2021 10:19:36 -0700 (PDT) Content-Type: multipart/signed; boundary="Apple-Mail=_C9FFAF1A-E19B-4D74-A2B3-21BE967A6840"; protocol="application/pgp-signature"; micalg=pgp-sha256 Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.60.0.2.21\)) Date: Mon, 5 Apr 2021 12:19:35 -0500 References: <0b8301d72a3a$71045ca0$530d15e0$@webkr.de> <0463c632-8260-bc8b-920e-4a9214421311@gmx.de> To: PHP internals In-Reply-To: <0463c632-8260-bc8b-920e-4a9214421311@gmx.de> Message-ID: <1D022A15-9169-4571-9DE2-E322C473EAE3@benramsey.com> X-Mailer: Apple Mail (2.3654.60.0.2.21) Subject: Re: [PHP-DEV] Raising the precedence of the new operator From: ben@benramsey.com (Ben Ramsey) --Apple-Mail=_C9FFAF1A-E19B-4D74-A2B3-21BE967A6840 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Apr 5, 2021, at 12:12, Christoph M. Becker = wrote: >=20 > On 05.04.2021 at 18:40, Andr=C3=A9 H=C3=A4nsel wrote: >=20 >> I was wondering... PHP is the only language I know of where you have = to >> write `(new Foo())->bar()` instead of >> `new Foo()->bar()`. This is particularly apparent with the builder = pattern: >>=20 >> $developer->drink((new Coffee())->withCream()->withSugar()); >> $logger->log((new LogMessage())->withMessage('Coffee was drunk')); >>=20 >> Since `new Foo()->bar()` cannot (and probably should not) be used to >> "dynamically instantiate a new thing of the class >> name returned by function Foo()", it seems like it would be no = problem to >> change the precedence rules so that >> `new Foo()->bar()` means "instantiate a new Foo and call bar() on = it". >>=20 >> It's currently a syntax error, so allowing it would be automatically >> compatible. >>=20 >> Has this ever been discussed before? >=20 > See . The last comment on that issue reads: > @Nikic > Good news. I'll prepare RFC for 7.1. Was there an RFC for it? I can=E2=80=99t find one. Cheers, Ben --Apple-Mail=_C9FFAF1A-E19B-4D74-A2B3-21BE967A6840 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- iHUEAREIAB0WIQToXQMR3fpbrPOmEOewLZeYnIwHGwUCYGtGpwAKCRCwLZeYnIwH GyQCAP4qVzFjzsSM0Nbdd0I5XsrvIw3JE0MAau0Dc/2wGuCwAAEAjAfa0WnsGLUw NNGEV0eKQSW+9LsvbGi2YeEFtPvznwI= =0bo1 -----END PGP SIGNATURE----- --Apple-Mail=_C9FFAF1A-E19B-4D74-A2B3-21BE967A6840--