Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:118856 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 74317 invoked from network); 20 Oct 2022 07:15:06 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 20 Oct 2022 07:15:06 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 1AA7E1804A9 for ; Thu, 20 Oct 2022 00:15:05 -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=-0.7 required=5.0 tests=BAYES_05,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, T_SCC_BODY_TEXT_LINE 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-ed1-f54.google.com (mail-ed1-f54.google.com [209.85.208.54]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 20 Oct 2022 00:15:04 -0700 (PDT) Received: by mail-ed1-f54.google.com with SMTP id m16so28594313edc.4 for ; Thu, 20 Oct 2022 00:15:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=H4XSoSyr5Mg3baEWsWSRqTGjRbMNUgw05ePr9vN9Aq0=; b=kUtKK3vnLsKjnv9+9TAXaHlcpED5OnYm+xPD6YJSvgRk3SJJXuSfcZxn+ufsfNuFCL wYC0rc2nCDSsrBT0iykhClDGtcwpOiu7dwZ9nVdY9VR4zH+EN0zaHh+auYjv0V2ngwfZ 2BPX46lRvsJohdhI3kRJtiM4MI9Mm262XIDgkMsji+VeVa8j4sZRsXA254qx7Cj7d0qt yiZ75w+d9cP/+BIcX+tksn1XANbLWM1Jn4EVHteIuXEDFY6lXW5b1REN7aRzpAmcrDaJ 0l3UmxQt+4y3Xex2baZ+frmP+/VFtk/Bd83xnM1jtiY5QmIxuGWpNvQ6XOPCpi4drsyp oNeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=H4XSoSyr5Mg3baEWsWSRqTGjRbMNUgw05ePr9vN9Aq0=; b=dRV4ZYHzLqu0pE4Zx9oCxsPKtyXV0c73nYp300lXuJ0lMkWGHUcC40pzHWuhYbgbyK DeWQPjtO/g13q3oGqji/ZNa7fiVgLw4+UnMaxhcnk6WLLukMoGVU3xc/OaKojqMFamZX zuJQXvgjETL+ZZrmLrRCTlyZ+bn+BT5+DG1kEWw8M8Ajfd9Q28s0Z5+MsdDUVPjPKBmM eCyVShXr1usiPoWUMadySrH9U+2hlONyxp0y7pGcsJN4ge+CGYP3HTq+2iFYIQE08tdi mSN+FzuHd1xuQPj1oE8D2Z+/+nzlwjgj3HaCMhVmZaKgwfRak4fFZ5BN33D0FTqczZpG LbYg== X-Gm-Message-State: ACrzQf2HtiLKquGGBdhETfGX6dtj2lH7xUHC4ReCIKmg8yQ3FGqYuqJp KnVtQ9seBxUwk+Z7vrV2qVc= X-Google-Smtp-Source: AMsMyM4kWp5wIExcQXlMy+aqT3LAgjZg6fA5s8y3Y/4ovoGDzOq2KGhqO75wOrJIyn2WGpxSiaznaw== X-Received: by 2002:a05:6402:f96:b0:459:4180:6cf4 with SMTP id eh22-20020a0564020f9600b0045941806cf4mr10976403edb.64.1666250103465; Thu, 20 Oct 2022 00:15:03 -0700 (PDT) Received: from smtpclient.apple ([89.249.45.14]) by smtp.gmail.com with ESMTPSA id a13-20020a50ff0d000000b00451319a43dasm11644878edu.2.2022.10.20.00.15.02 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Oct 2022 00:15:02 -0700 (PDT) Message-ID: Content-Type: multipart/alternative; boundary="Apple-Mail=_31C87B34-5857-4587-AD32-9D7AAD681E61" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) Date: Thu, 20 Oct 2022 09:15:01 +0200 In-Reply-To: Cc: David Rodrigues , Marco Pivetta , PHP Internals To: =?utf-8?Q?Micha=C5=82_Marcin_Brzuchalski?= References: X-Mailer: Apple Mail (2.3696.120.41.1.1) Subject: Re: [PHP-DEV] Compact can't resolve outer scoped variables using short closures From: claude.pache@gmail.com (Claude Pache) --Apple-Mail=_31C87B34-5857-4587-AD32-9D7AAD681E61 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 >=20 > How would you like it to work, if you pass a variable name variable to > compact then? > $x =3D 123; > $name =3D 'x'; > (fn () =3D> compact($name))(); >=20 Although it is difficult to make it work in general (of course), there = is the specific case of names given as literal strings, as in the = example provided by the OP, that does not suffer from the impossibility = of static analysis. > I agree with the idea of deprecating compact() & extract() and in > long-term variable of variables as well. However, in `compact('x', 'y')`, the name of the variables are not = variable, they are constant. =E2=80=94Claude= --Apple-Mail=_31C87B34-5857-4587-AD32-9D7AAD681E61--