Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113954 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 74037 invoked from network); 5 Apr 2021 16:48:44 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 5 Apr 2021 16:48:44 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id EE34F1804B3 for ; Mon, 5 Apr 2021 09:47:32 -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=-0.7 required=5.0 tests=BAYES_05,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-il1-f177.google.com (mail-il1-f177.google.com [209.85.166.177]) (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 09:47:32 -0700 (PDT) Received: by mail-il1-f177.google.com with SMTP id t14so10623807ilu.3 for ; Mon, 05 Apr 2021 09:47:32 -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=nRS/JAv7c0DNY/CbGoi/H6QemJPjaCCFhrgl5i9Tnfw=; b=icaBxknthNuBmCwcv8gH69Qo+SrJQqWkQfVn17NFBaU4QHT7mrP1VeTFBerRcs2lKY DdHwOunIcwfIsSB7TZdoX7sUNRbBDmFnwtIHVmRGP+UezNEwIFkD7xIA9DR6ZBzCjaQN Ly2FKrtKyXAVJvqV4x4T7JHTyzxo1yGnpJBz3FPOWBezxphLqrLhKXyRna/FxeJDRR2j xwko8OxYuQt9u7HooVFrSusi3d/tczgqsyui/cPoxMMm9xai0yRAVWvhcrqjKkKFap+6 tWJr+iToe72Bvlhf+dPI01O9sumEWadpZV6LSNydE2LenaXFoDI6N4d4eLF3Nr4B2d6z PIzg== 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=nRS/JAv7c0DNY/CbGoi/H6QemJPjaCCFhrgl5i9Tnfw=; b=g9Q6TDvegJult+VSNFCNckMTTnJ5QqPexwEqy5keAv4X5swltfPbnvAaoCI7/Y/CGk XPTG1S0nGi5MP3KQcMX0E3yDIsi9jNZ7QnkDk3e30DPssrlJBh+zuOfawAlFeHNsp1z0 xzG/hl4VHc6dGJ6LPJBDXucY4pQOvS+9VrIbNXennVUPqDjco2lo6DHsD46JbQlVUAl3 SEAMWDYToNYD0KlraETD12FmT2cLKvM0dl9IwWwH4bT5eqZeT/i5r3S51ZHtmXiZfSD3 OR4zi8irHo1u2qDfl1Lny59y0KkJPKQ9Rt7zptNsgZZox2j4QQ+3uVlcyGB8ajcTS6hu qS3Q== X-Gm-Message-State: AOAM532PT+9A+lj1py7G6pWtB6f2XVVLcDkcdzjQI8c1W9zIrhu8/qvV gtOOVPpTVCOMjxCJBjT0NFnNkHlK9lb2rZuI X-Google-Smtp-Source: ABdhPJwVpKLZG5bQsj8vJGjHsoiOIlH8swBeNnrqmV+5keNCDFqV/IIAXZxVIsNceSQOUwc+H2YyZw== X-Received: by 2002:a05:6e02:1563:: with SMTP id k3mr19108079ilu.38.1617641248616; Mon, 05 Apr 2021 09:47:28 -0700 (PDT) Received: from [10.10.42.56] ([96.61.105.82]) by smtp.gmail.com with ESMTPSA id g11sm4864464ilj.84.2021.04.05.09.47.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Apr 2021 09:47:28 -0700 (PDT) Content-Type: multipart/signed; boundary="Apple-Mail=_3BCBF0D2-D8CC-4E2C-A8D9-E4D12777CCFC"; 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 11:47:26 -0500 References: <0b8301d72a3a$71045ca0$530d15e0$@webkr.de> To: PHP internals In-Reply-To: <0b8301d72a3a$71045ca0$530d15e0$@webkr.de> Message-ID: 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=_3BCBF0D2-D8CC-4E2C-A8D9-E4D12777CCFC Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Apr 5, 2021, at 11: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? Mike Schinkel and I recently discussed this off-list. Mike, now=E2=80=99s = your time to chime in with your ideas on this. :-) My $0.02 is that this is unnecessary, but I can see how others might want it to avoid parenthesis soup. Cheers, Ben --Apple-Mail=_3BCBF0D2-D8CC-4E2C-A8D9-E4D12777CCFC 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----- iHUEAREIAB0WIQToXQMR3fpbrPOmEOewLZeYnIwHGwUCYGs/HgAKCRCwLZeYnIwH G1XjAPwP/ixHFAay/XYb4OVrjeiZCj/jzFSu/F+ffASxTvzy2gD/b5D6OvlpxTm0 /GKnxa4UzH/Aw/buzkpdfpPi+M1iNjU= =KZpl -----END PGP SIGNATURE----- --Apple-Mail=_3BCBF0D2-D8CC-4E2C-A8D9-E4D12777CCFC--