Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123548 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 7C0831A009C for ; Fri, 7 Jun 2024 19:39:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1717789227; bh=hYvxYy9LLEoJXKEUcJ38+eNdmMODTQX5iSF9ljhgaeg=; h=In-Reply-To:References:Date:From:To:Subject:From; b=KHFFeSTAjevv61U5W93+hSjO93mjQsVj3hkvNpPeS0+ZsvbekBaDqZTYDtLJSOOJ9 YxVobSRuMI4giJ+wFediEsT1TiYeEWYysGh1VCKziyba1yMaRdbfnZ9NA5+CqYv4D0 0b6wq9Qa/Z9W0yT7Ht+8pIwjtx04kHrRkyiZlJZq3rLoQto+DOyyFYNYR/WIlATzCG 62DrEcOsw9vIdyhvKkCa8lqBIdchQ0y+WewJJVa9XIywPqqn564GIDr5DYmerNBa/m is7r+vSQiRIZZSnI5TTQxrSaRWDo3gOyIH/qd+iBJMEg1RlIIrRAGUCHUx+qINSLzp JzEWtwa/7Cu/A== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 3A97A1808F8 for ; Fri, 7 Jun 2024 19:40:26 +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=-0.1 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from wfhigh8-smtp.messagingengine.com (wfhigh8-smtp.messagingengine.com [64.147.123.159]) (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 ; Fri, 7 Jun 2024 19:40:25 +0000 (UTC) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailfhigh.west.internal (Postfix) with ESMTP id E199A1800081 for ; Fri, 7 Jun 2024 15:39:18 -0400 (EDT) Received: from imap50 ([10.202.2.100]) by compute1.internal (MEProxy); Fri, 07 Jun 2024 15:39:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= garfieldtech.com; h=cc:content-type:content-type:date:date:from :from:in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm1; t=1717789158; x= 1717875558; bh=4ok+8NxhK1aD15miVSm5lqXvO4b2IViwxTP0NufMNNw=; b=A xjed6epw9iCyAt5Ww7Zx9sHNlFst8AeolstknyijWxcNjMDSV4O+fR+yWRuN8bTQ km0eQ0c2N+ou3IfIIPF61Ofgnt1al4lkW7us6NIz6jwvzH4cmFTP6NFFx6JZKVYh OPMkDpKLR29tcExqAXtzq+FiUSAEEAPnZ8Tj4cEF1syWXqW5h4GFlYmY0hsibva3 u7kupc4/U8wNZGYwGnoxoqYJHFoq9WAO9AfyknVFVRj1/jHkaq2hL3NCvdBnGpYF /nEiLrFNGnCSh7b6OCo3SgXwFsBm16/6TNj7MG1Q2TpxNxD8mvvjEIhoFDEPoUcc wX4eM2rfGq8v2C6gGOlHw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1717789158; x=1717875558; bh=4ok+8NxhK1aD15miVSm5lqXvO4b2 IViwxTP0NufMNNw=; b=pbFXYJLJGj4dN2nW1IswNiQgtbAXVyAJ39Ljc0PnGmNl Dgax6bQWp5WxKyuSXOvUWw6wlZqW3ogY/sw4p+NPcfotipPTmHc6xkBsRTWndVcn 2h0gtYHwz7yuS7rqeIRxAPA8K0TbSuoeo1hRXeimn/tJgM1VcJ6j54ci1liGhem4 XL5mdlnLorD4RZv3vbmF1NfANgIqcrShTd77LO83E7pyRPDACB9/rnA/KhEWPC+p FFiR8/xCYH5fce5Kfc9g558QYyGpn+nhZSatc0N46w5YcokhXuktljwterZb0DLM yqNwxJauUZoy6+jvrSEert18Zbm/MpDyXb6F4yXlgA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrfedtuddguddugecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefofgggkfgjfhffhffvufgtsehttdertderredtnecuhfhrohhmpedfnfgr rhhrhicuifgrrhhfihgvlhgufdcuoehlrghrrhihsehgrghrfhhivghlughtvggthhdrtg homheqnecuggftrfgrthhtvghrnhepgeelgfekudeivddvteffueejffdthfejieevhefg ffekudevkedtvdelvddvffefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomheplhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtohhm X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 10CB31700093; Fri, 7 Jun 2024 15:39:17 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.11.0-alpha0-497-g97f96844c-fm-20240526.001-g97f96844 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 Message-ID: <652c1a66-6702-4009-a4a0-d2221df00f69@app.fastmail.com> In-Reply-To: References: Date: Fri, 07 Jun 2024 19:38:57 +0000 To: "php internals" Subject: Re: [PHP-DEV] RFC proposal : "new" keyword shorthand Content-Type: text/plain From: larry@garfieldtech.com ("Larry Garfield") On Fri, Jun 7, 2024, at 7:20 PM, Pierre wrote: > I sincerely do not want to see a new operator for replacing the "new" > operator, because then we would have two different syntaxes which would > be semantically equivalent. > > Creating a new object, in most API design, is not something you do very > often, especially when working in a framework that does it for you > (dependency injection, etc...). This is not entirely true. Creating a new service object, yes, you rarely never do that yourself. Creating a new data object (value object, struct object, DTO, and a dozen other terms) is something that should happen more than most PHP developers currently do, because most of us have primitive obsession. (Or array obsession.) Consider attributes: Any time you want to have an object as the value for one of the arguments to an attribute, you need a "new." Any time you create a value object for a more strongly typed parameter than the horrid $options array, you'll be using "new." So I'm sympathetic to making that syntax easier, and would be OK with it if a workable syntax was found. But so far in this thread, a workable syntax has not been found. I agree it's not the greatest usability concern in PHP right now, though. --Larry Garfield