Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:111456 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 28794 invoked from network); 11 Aug 2020 12:41:03 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 11 Aug 2020 12:41:03 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 2C49A18050A for ; Tue, 11 Aug 2020 04:40:27 -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=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DOS_RCVD_IP_TWICE_B, SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from box.beccati.com (box.beccati.com [176.9.123.236]) (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 ; Tue, 11 Aug 2020 04:40:26 -0700 (PDT) Received: from authenticated-user (box.beccati.com [176.9.123.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by box.beccati.com (Postfix) with ESMTPSA id 6892C20030C; Tue, 11 Aug 2020 13:40:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=beccati.com; s=mail; t=1597146025; bh=IB2fozWkaY3+R9rw7VEOYMUnxfXJOKQrYtlgMJVYgnU=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=QSTIfZTkcZ7xt0o2RukTGBr1FfVwA10SHaPJnkM4k4eOxIPJri/+qE4mln8/pR0et m5Mhwd+EFdz9z0bd+pawEKldJucy57RnRsuHhJuFf6kAwBPz6kN+yVP9+xFUipYY05 2+90di2oZGPIxumUpHJmlzylm+eq/2Zi1SKc7v91i99OZik5eFK6+jmv4xdxN9x9zJ JA+/BeJdluLaQhWBD1n4CbOYO5UdHooda+RRnsBhuTLcCS4x3LdP9ZQGTXHhAMnn7l bE/Be5o02ubnssT4V7WKQGAvxB7gqnx31CQsIXijQHiGQUxRllWRtVrY2A3+pHEIMi NFkGKzY0ZuG2w== To: Chris Riley , Derick Rethans Cc: PHP Developers Mailing List References: Message-ID: <009179f2-74fc-ba74-fc82-28708169e400@beccati.com> Date: Tue, 11 Aug 2020 13:40:21 +0200 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [VOTE] Shorter Attribute Syntax Change From: php@beccati.com (Matteo Beccati) Hi, On 11/08/2020 12:10, Chris Riley wrote: > What is the expected behaviour of: > > @[Bar()]; > class Foo {} > > That would appear to be valid code and for the difference of a single ; > does wildly different things, assuming there is a function Bar defined > somewhere. (and only by the fact that @ doesn't suppress fatal errors does > it not cause utter confusion if Bar isn't defined) I think an 'unexpected token ";"', which is what currently happens if you do the same with "@@" on current master, would still be an appropriate behaviour. FWIW, I haven't made up my mind yet and that's why I haven't cast my vote yet. I do agree with Chris here and I somehow mentally parse the above as "silencing an array containing a function call", which to me is bad enough to rule the syntax out. I would surely get used to it, if accepted, but that's how I feel now. Rust's #[] to me looks better, but I am still bothered by the fact that it can be used in a backwards compatible way, but not fully so (multi-line, syntax errors). And "@@" is super ugly, although I'm not bothered that much by its lack of ending delimiter, since most of the times longer attributes will still, albeit just visually, have some in the closing ")". Cheers -- Matteo Beccati Development & Consulting - http://www.beccati.com/