Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:121896 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 66986 invoked from network); 1 Dec 2023 12:33:33 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 1 Dec 2023 12:33:33 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id DA24418003D for ; Fri, 1 Dec 2023 04:33:41 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-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,DMARC_PASS,FREEMAIL_FROM, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-pj1-f46.google.com (mail-pj1-f46.google.com [209.85.216.46]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 1 Dec 2023 04:33:41 -0800 (PST) Received: by mail-pj1-f46.google.com with SMTP id 98e67ed59e1d1-285d1101868so1799724a91.0 for ; Fri, 01 Dec 2023 04:33:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701434011; x=1702038811; darn=lists.php.net; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=H3ve+c9dsr3oFcE/GHDcl65V+iccPxXG43Z0QK1pO6o=; b=Zyw+jKG5U79YpspanxD6fjY1HAg4Voi8l9EVekj3YPFSHdcYY1fehTyF7Paj5AoFwa NXYCLDveoexWm0zf23csLmkLoiLnrhV5pTbl/xjqqE6of83Q2HH82Ys43rO4f0agfg7a 1OU+LtG2GHihvk1Al/9qAePXqKMYWHiTWDIfuavvwoXIBuNrgk69ZoujzJP7gptA0vz7 xB/f6C+alDHMMdwsQ5tT6Zo1G0ZGNU+6SZ2BE3UWL/OFbw6IJS1bl0Gn0meYBmtlSDIM fMfj8RkBkSx0FrlHHtxf0FKoCbqTzUJWVhD5u0H+Uuyaw6JgbI3ferngMs7CL+jU2WhM TCFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701434011; x=1702038811; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=H3ve+c9dsr3oFcE/GHDcl65V+iccPxXG43Z0QK1pO6o=; b=LvTicmYWGoWMqtC0of0RoY61LaHQZJVrkbwriSJuuGeG/yXPxEfpm2SRBiPZJnLPku YgdLY2eFLFuLO+/zws9SKWguyuOZcfKmTInJ1SA/X4uh1sGgnv1La5qF8tcuYJdgZ4pd DI9ZKviMLxpYUPVGBpLYSXWxAkWxbVHsFk7Evf3pDYCBzDqt1g1qAR8i5p9fWYcralCz CpPOxeLlPoMWttvCpnpCKnfZV59lSha9B42FbKzzDDtzxKPEE50gZS9KLO15fA7TOmGv xdPXev2mVXhVS3yfe3adXM38c4JqucjHVtkQcO27y12nMbnbHPjuWBOBaCpwKyiK9Ylf gZJQ== X-Gm-Message-State: AOJu0Yx+tXbKkj5z1QHBrP/8Riy0PaypjecZ6gDwBCh0H45GsQOm44AS g7vMOgxPKg8nl/66KqFHbNggzYnH6OftbLjx+qF2Z1gZ/JCr1A== X-Google-Smtp-Source: AGHT+IHuRkfHP8SRgl0iQWF4JsBl+09tgtk23Prq60LjMgldbR6tutMESeWuHQ5NPRRCupFCfYGDYRhNwzXZYv2gF4M= X-Received: by 2002:a17:90b:3b51:b0:285:bc26:6c62 with SMTP id ot17-20020a17090b3b5100b00285bc266c62mr18264092pjb.29.1701434010792; Fri, 01 Dec 2023 04:33:30 -0800 (PST) MIME-Version: 1.0 References: <6566989F.7010305@adviesenzo.nl> In-Reply-To: <6566989F.7010305@adviesenzo.nl> Date: Fri, 1 Dec 2023 13:33:18 +0100 Message-ID: To: Juliette Reinders Folmer Cc: "internals@lists.php.net >> PHP internals" Content-Type: multipart/alternative; boundary="000000000000d27a0c060b71f969" Subject: Re: [PHP-DEV] What is the prevailing sentiment about extract() and compact() ? From: ocramius@gmail.com (Marco Pivetta) --000000000000d27a0c060b71f969 Content-Type: text/plain; charset="UTF-8" Hey Juliette, On Wed, 29 Nov 2023 at 03:00, Juliette Reinders Folmer < php-internals_nospam@adviesenzo.nl> wrote: > > For now, I'm just wondering how people feel about these functions. > From my PoV: burn them with fire. The translation of `compact()` is **trivial** with a CS tool (like the one you maintain), and the translation of `extract($vars)` is `foreach ($vars as $k => $v) { $$k = $v; }`, and that's all there is. Instead, both `compact()` and `extract()` come at additional cognitive load when reading, scanning, analyzing, debugging and generally understanding code: a flamethrower helps. Meanwhile, I'm also wondering if the removal of such functions would help more in future AOT and JIT improvements: I suppose code using `extract()` and `compact()` would immediately defeat any JIT, or at least lead to added code to handle them correctly? There's a section describing this in HHVM, which is the kind of problem-space I was thinking of: https://hhvm.com/blog/713/hhvm-optimization-tips Marco Pivetta https://mastodon.social/@ocramius https://ocramius.github.io/ --000000000000d27a0c060b71f969--