Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112158 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 73177 invoked from network); 1 Nov 2020 01:19:10 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 1 Nov 2020 01:19:10 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 92AE81804C6 for ; Sat, 31 Oct 2020 17:38:56 -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.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sat, 31 Oct 2020 17:38:55 -0700 (PDT) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 3EDC25C0079 for ; Sat, 31 Oct 2020 20:38:55 -0400 (EDT) Received: from imap26 ([10.202.2.76]) by compute4.internal (MEProxy); Sat, 31 Oct 2020 20:38:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=8TMI63 rMhH3bR/QMhpE3lWKgvQR+jPpLi5yXRLoRtiQ=; b=Njd+jQTrnJ/stITWRzarHO Y1t5jSts5z3GFiWWTGMrpqlEMHmheTYnHSz7vRBAawbY749I3wRCAT22C/R8y25C 3djq55G7+3F6Xh63Iy6Si1P+syKCVn/2BfOnAWkzj1pHhrbrlwbSIsmhPHWwNgtY KW2jtXAjLm6rAUZNUAVk5kph0Nb1m1TW2xKHecGY279GuRpwTe7NtPikV1hvgV61 9wyWftSQ2d9FbOyUT7Vioo9nQtBHh8wazqB9tOIu+z4QlfR5v6do6RlLB5IhQ7lb OwTMnlaDOR2941enjA7FfBIlnN3y/0c4cpHp/vuxp9qmRD2Phoz7mUotxXng9BOA == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrleekgddvfecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefofgggkfgjfhffhffvufgtsehttdertderredtnecuhfhrohhmpedfnfgrrhhr hicuifgrrhhfihgvlhgufdcuoehlrghrrhihsehgrghrfhhivghlughtvggthhdrtghomh eqnecuggftrfgrthhtvghrnhepgeelgfekudeivddvteffueejffdthfejieevhefgffek udevkedtvdelvddvffefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrg hilhhfrhhomheplhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtohhm X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id E1DCF14200A2; Sat, 31 Oct 2020 20:38:54 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.3.0-530-g8da6958-fm-20201021.003-g69105b13-v35 Mime-Version: 1.0 Message-ID: In-Reply-To: References: <258d9a8e-e73e-7b8a-5d9f-64a449def1da@gmail.com> Date: Sat, 31 Oct 2020 19:38:33 -0500 To: "php internals" Content-Type: text/plain Subject: Re: [PHP-DEV] List of attributes From: larry@garfieldtech.com ("Larry Garfield") On Sat, Oct 31, 2020, at 5:06 AM, Rowan Tommins wrote: > > This would be > >an artificial limitation on attributes to patch over the inherent > >inconsistency of the grouped syntax for nested attributes. > > > There is no artificial limitation; there is a binary choice: does > #[Foo] represent an object or a list with one item in? This is > completely new syntax, so there is nothing for it to be inconsistent > with other than itself. > > I am arguing that having it represent a list with one item in is > actually *more* consistent, because when you attach attributes to a > declaration, they are always retrieved as a list. Perhaps a naive question, but I'm missing the downside of: #[Foo(Bar(name="baz"))] #[Attribute] class Foo { public function construct(public Bar $bar) {} } class Bar { public function construct(public string $name) {} } Why is that not OK? Someone mentioned it means you couldn't call a function there, but... that's not a huge problem because I can't imagine why you would. If we really wanted to avoid that: #[Foo(new Bar(name="baz"))] That would be unambiguous, if a bit ugly. --Larry Garfield