Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:111269 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 42923 invoked from network); 30 Jul 2020 17:22:13 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 30 Jul 2020 17:22:13 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 5336E180563 for ; Thu, 30 Jul 2020 09:18: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, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-oi1-f195.google.com (mail-oi1-f195.google.com [209.85.167.195]) (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 ; Thu, 30 Jul 2020 09:18:34 -0700 (PDT) Received: by mail-oi1-f195.google.com with SMTP id y22so24161268oie.8 for ; Thu, 30 Jul 2020 09:18:34 -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=wHODvtL7xvN+tF/aVxldYEJ/BrDKyIr2oZHfFyEzw4Y=; b=AKuEPZEuYKzlpZWhuKpgNRPofRp3GD3CQG+Ia7SZzncYQdZgW727PUHpApTfProNYv oVPlQ9rW4C0Jyb44gM8cvzLb29YJ1VytGrsELbAWvzXNuOI/1C/EwE1ns/355m4FGH15 XIZ/U7u9m7WE6MveyWpz39YNZhsUdVW3KIqK/KxL6+jxHsMXBUKFTpBeSqMg+rdCbks7 9NJltmPFlmx//F4z8wqDXonUTU6EePi/IWzYQA6yds42wzgpK2+P3eeY8Acz0hkWDWvC FlmCBQtBiGO9FAcWYHbaRro4vb72Pn+w8XL6W4MWuPw9obfoza3TdWII7w/iPkjkXFwH 5ecg== 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=wHODvtL7xvN+tF/aVxldYEJ/BrDKyIr2oZHfFyEzw4Y=; b=syo4dGs69kCiH+bSAF3P9jRnfZJIFuvyoxl5fokyUQoavHrWyoosK1QGFP4g6iHnD1 Lvggcs36X70r/3AcAN8Tm7TBF8Edvhr6pfrG0GKy3LhChr8bFvNbBps3lMF4U/fSd91W KHDJIkuPikLsUMlF9LzJeyTIz8YTJgwJHcwkV+pQTvZ7Qf0Gckkfaw8zGXMRJFolzFGr Xwsfaa/uTYyLlI+lTvVogLcruAmm9zOronSwI5QPNO6Ty2qWO5LO/gaj/zaSjiKJZTJm dgGG0338NmCx4xoJeQMnmEx3zobrnKEh9dAczvEUAOnUubPOr98C2IIFICZ4aePCDdIk OXSg== X-Gm-Message-State: AOAM531rD1h3GVNRP3wiDF1qm8jJWqju27C/F5frIMervYXmO98zjcrl LZQNHo6uOifry8eTgurRAyXgTEuCy5WQVYvNsFGGvVz/ X-Google-Smtp-Source: ABdhPJx3rdCLypRbBJysrHcnZ36OpfRx1tAjXc9OCKZfhx5Z3gnPnt2HepGi+VbTD/IpauPkUgm+0yF9GNLJHAc9nHo= X-Received: by 2002:aca:3c43:: with SMTP id j64mr1195823oia.178.1596125911116; Thu, 30 Jul 2020 09:18:31 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Thu, 30 Jul 2020 12:18:20 -0400 Message-ID: To: Rowan Tommins Cc: PHP Developers Mailing List Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] [RFC] [Discussion] Shorter Attribute Syntax Change From: guilhermeblanco@gmail.com ("guilhermeblanco@gmail.com") Question: The key factor of not using @ is due to conflict of suppression symbol. While we are in a major (where BC breaks are not encourage, but tolerable), have we considered the possibility of BC breaking suppression symbol (@ would become @@) and using @ for Attributes? I bet a search/replace wouldn't be that hard to be achieved, and it would function even today (as @@ is acceptable). Basically, it's a BC break where code needs to be changed, but backwards compatible as new suppressor symbol is backwards compatible with previous versions of PHP. Just some food for thought.... On Thu, Jul 30, 2020 at 11:57 AM Rowan Tommins wrote: > > On Thu, 30 Jul 2020 at 14:28, Joe Ferguson wrote: > > > ... I'm still here wanting us to talk about the > > impact of @@ on static analysis tools. Apparently, internals doesn't care > > about these projects. > > > > > I don't think that's a reasonable summary of this thread at all. I've seen > three main types of response: > > 1) "I haven't followed the discussion about PHPCS, please could you > summarise the problem." > 2) "I don't understand why tools running on PHP 7.x need to parse PHP 8.x > syntax." > 3) "I think #[] will cause as many problems for such tools as @@, just in > different places." > > Maybe they weren't always as polite or succinct as that, but not agreeing > with you is not the same as not caring. > > > As far as I can make out, attributes that appear entirely on a single line > with no other text are trivial to ignore in any parser whatever the syntax. > That trivial case is slightly more trivial with #[] because a PHP 7 parser > will treat it as a line comment; but add a rule to your parser to also > treat "@@" as a line comment, and you're done. > > The problems come when you have a) an attribute definition spanning > multiple lines, and/or b) an attribute definition inline with other code. > As soon as you have that, you have no choice but to parse the code entirely > according to the grammar of PHP 8, not as "PHP 7 with some warts". > > If detecting the end of annotation tokens is really that difficult, would > it suffice to make the () mandatory (i.e. @@Deprecated() rather than > @@Deprecated)? The rules for what could appear between @@ and ( are pretty > simple, and finding the correct ending ) should be pretty much the same > effort as finding the correct ending ], since both can occur in matching > pairs inside the argument list. > > Regards, > -- > Rowan Tommins > [IMSoP] -- Guilherme Blanco SVP Technology at Statflo Inc. Mobile: +1 647 232 5599