Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:111279 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 21883 invoked from network); 31 Jul 2020 17:24:15 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 31 Jul 2020 17:24:15 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id F23A8180549 for ; Fri, 31 Jul 2020 09:20:54 -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_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-lj1-f196.google.com (mail-lj1-f196.google.com [209.85.208.196]) (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 ; Fri, 31 Jul 2020 09:20:54 -0700 (PDT) Received: by mail-lj1-f196.google.com with SMTP id q7so33010390ljm.1 for ; Fri, 31 Jul 2020 09:20:54 -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; bh=TTQhn11uNfdOnDS2HUeNe3QnZBlDhLXjDBzVmtwnfsc=; b=Bses+QthyU+W42wnpHpqoT5xC+0ciyJAzSfVzcJkyOUkvdQlQguXZYbliCVqwgwdho Xwhi1tWhIhumG5d4BJ5mVmPRyDRNXiejOr7ns3rhtEAcU1kWLMPNuuDNOv1moT/2+P2n X9zK51+7rkwSNT7UnS5P0t9j0FRgzQs7gQNqUOC98WbIS1p8jw+RPIVs/tvXQqla1VzE G1Bn6Spzv56d84jraXzitH5V9rDERdIGD/Hez/T+VW9+7CCX78Dfq8SxoQnFqnKDocB9 WY7QlN4SCRQBr+o4zxFznlvcaizuoPceULeNRJVUk1Xy5KK3d5W3s19g+Wgw4afpzQ70 5erQ== 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; bh=TTQhn11uNfdOnDS2HUeNe3QnZBlDhLXjDBzVmtwnfsc=; b=b+TeNvz0Gh10XL9Kck+j9gLj0Kk4Hgu6WaIEwa2FejkPiN7xV5L1re0kOSk6+ZtfbL pf07B4OI4TkXITZiRvUv5eZWb/2NmkZOamH4NehNC5ZZ/jjmY+wQNeGp/CHT84RuxE+h Zso1mNBNrib+2OEoAljD/iHKl/ILTtpCr3zR71p1AxgLeg5lMXbnbH1tkrEECdxP+fKF n61nCbEMomHZVi3Gw9DfNp3+5Y7Ys0bMY2UZ2X1qOf2LmyEFEEfXBiT1dTwX+aSHtqur EPeyk5tIqXGr2f+WKmQlm4tImXH9iciHMhkWDEKA9oZTrzyAsV+zjRBkqXPevCa/qZaT q6wg== X-Gm-Message-State: AOAM533cfx944o+EA2fA4zAEQl5h5FV66KYbMW8PtUkX8O4rjR/qvkh2 Q/12mTI29lT6KxBmna0MIeGX5xtN1RyK7BJEEMsyigo= X-Google-Smtp-Source: ABdhPJwIKrWwD2iL+b1q90Q28TrZpuazKRFNI8dvwcSwzpQGg5o8BQobn9YStxPvdpm7ehIeIT699T5h64jZhp5FljA= X-Received: by 2002:a2e:9b41:: with SMTP id o1mr2291478ljj.360.1596212450841; Fri, 31 Jul 2020 09:20:50 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Fri, 31 Jul 2020 18:20:38 +0200 Message-ID: To: PHP Developers Mailing List Content-Type: multipart/alternative; boundary="0000000000001e56be05abbf2c82" Subject: Re: [PHP-DEV] [RFC] [Discussion] Shorter Attribute Syntax Change From: kaznovac@gmail.com (Marko Kaznovac) --0000000000001e56be05abbf2c82 Content-Type: text/plain; charset="UTF-8" HI, [disclosure: I'm not php internals/interpreter developer; have ~10 years of using php language] I've searched but couldn't find in this discussion: Can we keep the 'current' [doctrine/annotations or similar libraries] annotation syntax and implement parsing of metadata in PHPinterpreter? [something like having internal/native doctrine/annotations implementation that can use opcache] pros: - existing tooling will continue to work - existing code will continue to work - no need for developers to migrate their code - no need for developers to learn new syntax cons: - code comments cannot be removed from opcache :| [or can they? if metadata/annotations get parsed and attached in preload - comments can be discarded if not needed in runtime] I'm sorry if I've added some noise by missing something that's obvious; I would really appreciate it if someone from the php internal comments on this. cheers, k On Thu, Jul 30, 2020 at 7:24 PM tyson andre wrote: > Hi Joe Ferguson, > > > Now that it seems the technical concerns around @@ have been resolved by > > another pending, passing, RFC, 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 care and I'm trying to help. I'm not trying to > > revote until I get the vote I want. I'm just a dude that had some free > time > > while on vacation when he saw a chance to contribute. > > 3 commonly used static analyzers (for type inference) are > - PHPStan and Psalm, both of which use nikic/php-parser. As Nikita Popov > (the maintainer of php-parser) wrote, > > > Emulating #[] lexing on older versions will > > definitely be a challenge for PHP-Parser. I don't think we should make > > concerns of external tooling hold us back too much, but the phpcs > argument > > really doesn't hold water. > > Comparatively, it would be easy to join two adjacent `@` tokens to a > single `@@` token in a single pass over token_get_all. > Parsers would likely already do that or benefit from doing that for tokens > such as the `match` token (T_MATCH) in php 8.0. > > Another commonly used static analyzer is Phan ( > https://github.com/phan/phan/) , which I am a maintainer of. > My reasons for preferring `<<>>` or @@ over `#[` were mentioned in > https://externals.io/message/111218#111239 . > > For phpcs and other linters, my belief is that this might be easier for > simple use cases in the short term, > but edge cases or ambiguities like multi-line attributes or refactorings > that were safe in php 7 > (such as moving `#[]` behind other tokens to another line) > may cause issues for users of those tools (until those tools drop support > for php 7.x and older). > This is why I'd advocate for a distinct token that doesn't overlap with > line comments > > Cheers, > - Tyson > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php > > --0000000000001e56be05abbf2c82--