Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:110057 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 65520 invoked from network); 7 May 2020 09:43:04 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 7 May 2020 09:43:04 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 7C6A91804C2 for ; Thu, 7 May 2020 01:18: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.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (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, 7 May 2020 01:18:26 -0700 (PDT) Received: by mail-wm1-f47.google.com with SMTP id g12so5710058wmh.3 for ; Thu, 07 May 2020 01:18:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=beberlei-de.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=jX8QA3s4E7I5a17377pPUX8uF9x7JU46KJlCLfzx/R4=; b=Hr8ig6LeTRs+vAOO3G5dyPgohSne/4OUUQ24vFH1vKSuT9fwp55mo/s0KuEsCplr3j 914gJHyQfcE1DuprSyka9JGdxsa/5NuR1mP9tpt6CW/+MrV67/sVUDWvlmn2l0PKAQUC PghCbguxcEuiVT0rNTnkj5STzYZF+OL2dNeyyo7//IN2qPeDSLwBwXA4DknCFlaQ6ypk TATQUI+pUGb5K99fL1cI/IngKaJR73lyK+ne9uamJ7FIQxfZjRUIiohPMNuIy+EKLx24 YCAgzfHrRQbpbqOn7JMBGjdcxU0v7KMIOJ0kJXd7Y90nCuL/N2c5KtU5QQbTxgUHV82X v1PA== 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=jX8QA3s4E7I5a17377pPUX8uF9x7JU46KJlCLfzx/R4=; b=Dpi6BnTV2+1dDSun99Ghp2QpA5bnqbJlVMKS9UWyup7OLG3JLVD5o7bVZG+1ZvZsrI tq1qiEPEsa428sRZZpGCSN2tFPKr4DJLsnrHV0Rlg69PtbE+YIsH+f9yS+CEcz1xHBqt Em9hg3ZsJiHtgEtgoqDUFAj4oa5QrbyI7xPbGJxSyW1FBL0ikZvKvBGrMaBx6qEVE0rk Q7WTsWxkVzRAHtUI77VDNkG4XaTIlTKnh2lBndcuGQuNoiJpE7C/TlrDVNXrqRypswb3 c0S1xnR3xqBZKj/rV3qwM/6hr3HSeHYh/l3c06EkhgRTJwHKiRdwzBJmlSLiqMXJAFZ/ d/GA== X-Gm-Message-State: AGi0Pub2gqla0HEtch1JfuwG9hrSbd42Ox1uqzjjSBsdc9/1O1wZ53L7 36S4YWLWIlP+8NbBHT868c4ILRnWs2EiTh8kZcHZqJzo X-Google-Smtp-Source: APiQypJSBf0V4Hj/YcIolxwfmN3YksIsrHCWcfgNStOJqee/lsC7bSqGRtmhUSYbTB6uj+YPLDSCZCchnKUkpwRTlSQ= X-Received: by 2002:a7b:cf23:: with SMTP id m3mr8652341wmg.36.1588839503056; Thu, 07 May 2020 01:18:23 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Thu, 7 May 2020 10:18:12 +0200 Message-ID: To: Davey Shafik Cc: PHP Internals Content-Type: multipart/alternative; boundary="0000000000002f666305a50a86f5" Subject: Re: [PHP-DEV] [RFC] <> Attribute From: kontakt@beberlei.de (Benjamin Eberlei) --0000000000002f666305a50a86f5 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, May 7, 2020 at 10:10 AM Davey Shafik wrote: > > > On Thu, May 7, 2020 at 00:22 Benjamin Eberlei wrote= : > >> Hi everyone, >> >> The attributes RFC specifically looked into the use of attributes at the >> engine/compiler level. >> >> To have a showcase of this with the 8.0 release I want to propose this R= FC >> for a <> attribute: >> >> https://wiki.php.net/rfc/deprecated_attribute >> >> <> is the most obvious engine attribute to add at the >> beginning >> in my opinion, as >> >> - all other languages with Attributes/Annotations support have it as wel= l >> - its effects are quite obvious to understand, as such offer a good >> example >> and intro to attributes >> - with potential property/class constant deprecation it adds something >> that >> was not possible in userland before. >> >> Let me know what you think! >> >> greetings >> Benjamin > > > Hi Benjamin, > > Two things: > > 1) as a matter of course, I prefer things that can be done in userland be > done in userland unless there is a clear performance or other win. This > doesn't qualify for me, except that it would be possible to use the same > mechanism in core, but that really only gives us the ability to reason > around depredations with reflection and I don't see much value in that. I= 'm > not entirely convinced that a PSR and a defecto implementation isn't a > better solution here. This isn't a show-stopper though. > Can you clarify a bit your argument "ability to reason around deprecations only with reflection"? At the moment we can only reason about deprecations by using both token_get_all and finding that a method calls trigger_error E_USER_DEPRECATED and by looking at the doc comments (via reflection) for "@deprecated". My argument for this attribute is that it leads to both a documentation based deprecation, and a runtime declaration at the same time. It is a better result than what we can do in userland in my opinion. > > 2) AFAICT you cannot add an attribute to a function argument, and the onl= y > way I can see to resolve that is to add a "DeprecatedArgument" attribute > applied to the function that takes the name as the first arg (and the > message as the second). Now you're looking at: > > <> > <> > function bat($foo =3D null, $bar =3D null) { } > > It's not great IMO. Having said that, I don't think this bit is really > necessary =E2=80=94 unlike the other suggested uses, an argument isn't an= isolated > thing, so much as part of the function signature as a whole and removing > arguments is better done by deprecating the entire function and introduci= ng > a new version with a different name. So maybe we just don't need this? > It is possible to add attributes to parameters. This was added as an improvement during the Attributes RFC (it was not possible in the first draft). --0000000000002f666305a50a86f5--