Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:111479 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 94204 invoked from network); 11 Aug 2020 17:38:55 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 11 Aug 2020 17:38:55 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 596C118050B for ; Tue, 11 Aug 2020 09:38:23 -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.4 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_SOFTFAIL autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-lj1-f173.google.com (mail-lj1-f173.google.com [209.85.208.173]) (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 09:38:22 -0700 (PDT) Received: by mail-lj1-f173.google.com with SMTP id f26so12835850ljc.8 for ; Tue, 11 Aug 2020 09:38:22 -0700 (PDT) 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=lImrpKbyGd6ep2n7G3fjvh2VubxtGWjTe0S8vcGG8dE=; b=iFOkZGHTFvADXfkGeiLHdaQHu9Tu11MjTmT1aQO2/k7PRw+FVM5ewZwC9jVq2G4Xnc dKYx2G+PUZHDTMbHppYXzBtFlEZP8MBUuuL2Xphc5hi7sGRhMrQBxRS2/OvD6ryLN7Gp GaD13NWyJWvNaSQ/SL3hoCsHNzqbYxuo6iBxutM2H6rTZ+uWRChFYNX5zVSNrEdEBpW8 nplDE+8uq1G9kHgHgimPV+33AUHTsOg5x1JFTpm67GAkrz0sDeka8/PKzUY/Mei+8eC+ rerjJHQ/JPgU0NN+6dZ2kmwpQZWkoX4P+NRu1Iq17UAVxjca13jT0SSyemhiakcr+GJ7 Mplw== X-Gm-Message-State: AOAM532xE5qjbqvveebdFYLT05P9ZJRpRJu6xz73DSpI/kUlodNfX4Tj D9bzzPa5402r35rypN+Dm/sBBEoi9jWD4WbNXYeTtw== X-Google-Smtp-Source: ABdhPJxHyG6SImOul5lRHxjtZJpY7/KxtMy5rmXmG/srNxEgcDuocEUBOUAB/5PgRFYFXmGhmxdnS8h38it1q7pC/es= X-Received: by 2002:a05:651c:238:: with SMTP id z24mr3523887ljn.172.1597163901466; Tue, 11 Aug 2020 09:38:21 -0700 (PDT) MIME-Version: 1.0 References: <59019606-a3fd-3c19-e962-a847689244a9@gmx.net> In-Reply-To: <59019606-a3fd-3c19-e962-a847689244a9@gmx.net> Date: Tue, 11 Aug 2020 11:38:10 -0500 Message-ID: To: Andreas Leathley Cc: PHP internals Content-Type: multipart/alternative; boundary="000000000000fed2c305ac9cb248" Subject: Re: [PHP-DEV] [VOTE] Shorter Attribute Syntax Change From: pollita@php.net (Sara Golemon) --000000000000fed2c305ac9cb248 Content-Type: text/plain; charset="UTF-8" On Tue, Aug 11, 2020 at 11:25 AM Andreas Leathley wrote: > This would be a feature if libraries start parsing PHP token by token > and start supporting the #[] syntax for the 7.x versions of PHP - then > early adoption would be possible and it would be a real feature. But it > seems unclear if that will happen, as it will probably have a heavy > price on performance (and might have some complexity). And if some > libraries implement it but others don't, then it might get confusing for > users about why the new attribute syntax sometimes works and sometimes > silently does nothing. > > The perf penalty on 7 and earlier would probably be similar to existing state of the world. Parsing a docblock is easier to fetch from the runtime (as we actually store it), but docblocks contain more than just annotations, so some plus some minus. PHP 8+ performance on theses would certainly be between though, and that's an extra carrot to push users to upgrade. If annotations can't be written until after users upgrade, then that carrot vanishes. > It is also not perfect as multi-line attributes with #[ still break, or > code with #[] followed by more code instead of a newline and then more > code. > > That's true. It'll take some care (and possible reduction in readability) to make annotations work well across verisons, but it's better to have an option than not, no? -Sara --000000000000fed2c305ac9cb248--