Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:111457 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 30531 invoked from network); 11 Aug 2020 12:51:14 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 11 Aug 2020 12:51:14 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 6027B18050B for ; Tue, 11 Aug 2020 04:50:38 -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,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-pg1-f170.google.com (mail-pg1-f170.google.com [209.85.215.170]) (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 ; Tue, 11 Aug 2020 04:50:37 -0700 (PDT) Received: by mail-pg1-f170.google.com with SMTP id v15so6527593pgh.6 for ; Tue, 11 Aug 2020 04:50:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=SQjahJkLXBgbwyuAPY7pThWhZLAxDw1Tp/IfC8t3YUI=; b=TlMUkMOmBWAIgpyJqUD7yRJOxxIG6PJ/F/GBXR71O/td5j0jNF91sfYvciRmqXZNGW 0K0GdXur/He2s0JVH5G7l5P7Dd2/cpn67vcbm2OVFEhyHVPHYgcHrr10R0srJbzH/Nop yaAvIOeoFLa56OsXSVBM8FURJdo3Gr+NV+LShRd1Z6A9OCgl6wX9byg1Wx0PMr3E4NFU ARNbyzF2OT2fPgC3fYw34NCHi8HrNVpNsEcRRATwvrpdzlTE8IjKJgCP18mW4rNaXP4X cfqwvBegPOyBZUUgYztGzWVIbNHWCgEosKFBqQvQDYcn4Mv9Rxc7/b6e0s4mMT9wFU3+ p0Fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=SQjahJkLXBgbwyuAPY7pThWhZLAxDw1Tp/IfC8t3YUI=; b=Cs6ahKWSJ6dexAUscQ35d6svhTn4B0YCRFyvHGeEF4dmTc1lUUEJ4p7qRyPiTbYKiP XSxms/h5nossgluIbE9EUOc+ALRi9b3KRKnBVYYAHZ8wjGritHuUgCX11dTpzHMvTm6R MTxZf56jBbeGRuQVwvFuS4zz72bpzfcRtDv4lyv9B7mDZy7Ae1GQ6BLWZe946J5AFju4 7Go+jyHC5utsiPFdA1Cyt7X15UnDrwFbQPgGLzksFeZHiN9myG3xYLul8HJoV0F3QYWS fvpbRrQ3Laj9KmCgXk5/seKFdOR541qGyWbZ3GC3pfVo1+e30J0E5WwpT+Nd4/0zSNN0 gMuw== X-Gm-Message-State: AOAM532bRk1s7QXLP6g0YO0wv5Qx5eoQj+mn9f1tWPwrxx5ctr8Bs62e 8Ry39delmhEshDHs6/YPg/fK+0hkt808y4hKtFM= X-Google-Smtp-Source: ABdhPJzcDXOYxEDbXNBtQBpPGlMsNsdcDQUHqFaMMdzyc/0kvnniOL/Q+GdfYdvPpTAA6RLYnBKeXB6ReWW+wG6uVnw= X-Received: by 2002:a63:3d06:: with SMTP id k6mr506498pga.316.1597146635988; Tue, 11 Aug 2020 04:50:35 -0700 (PDT) MIME-Version: 1.0 References: <009179f2-74fc-ba74-fc82-28708169e400@beccati.com> In-Reply-To: <009179f2-74fc-ba74-fc82-28708169e400@beccati.com> Date: Tue, 11 Aug 2020 12:50:24 +0100 Message-ID: To: Matteo Beccati Cc: Derick Rethans , PHP Developers Mailing List Content-Type: multipart/alternative; boundary="000000000000e473b005ac98ada8" Subject: Re: [PHP-DEV] [VOTE] Shorter Attribute Syntax Change From: t.carnage@gmail.com (Chris Riley) --000000000000e473b005ac98ada8 Content-Type: text/plain; charset="UTF-8" On Tue, 11 Aug 2020 at 12:40, Matteo Beccati wrote: > 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/ My concern wasn't so much of mentally parsing it as a silenced function call in an array; more that PHP currently parses it that way. That example becoming invalid code would be a reasonable option, but leaving it as valid code just sets people up to spend ages hunting a "why is this annotation not being applied to my class bug". (and before anyone says this won't happen; I have spent hours in the past tracking down missing annotations which occured because of the difference between /* and /**) For the record, my preference is @[ ], I just also like removing as many potential cases of debugging stupid issues as possible. ~C --000000000000e473b005ac98ada8--