Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108330 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 98719 invoked from network); 30 Jan 2020 10:00:15 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 30 Jan 2020 10:00:15 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id B3BA31804AC for ; Thu, 30 Jan 2020 00:11:04 -0800 (PST) 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-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) (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, 30 Jan 2020 00:11:04 -0800 (PST) Received: by mail-wr1-f48.google.com with SMTP id b6so2904123wrq.0 for ; Thu, 30 Jan 2020 00:11:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=V+OSxkQ2agZbYHhSx+Xsv2gLBXtK+uE5zrTtJw+XBA0=; b=jx6oCNADiY9Z2CvOMAv2QCdIcZKrYljW7qhOGSj30HFlkih+A14XIAu/rnbX1Ksrg6 gZ7xaYgngDPIG4Rw5r9wbEE21g/PWpxeIgDr2074vq9+fPMudvtHYPTrnxd0NKI3HJmd 7btossbaXHzAcnXDLwRD47p9FIi85dtb09+znve5kGy4ccMUVVlBa4p4JCtsqeLgl3wy XQTqCGooOkBflFJ3G8cwpQmrK7hbtaFHcfQQrorY0fpLcX8i2t5RJ+rOF7YKvrhn/i6o VYAIcB/WRDBVRigRi9Y4xHShohZJ6o7UrreiMCu+prCeyGDSUgyzzdVWHlDNhKF0DB4z e+8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=V+OSxkQ2agZbYHhSx+Xsv2gLBXtK+uE5zrTtJw+XBA0=; b=S+EVTF5BHqyNj2ihDSMgkca3cUqFG1ApVsDUkndOEboo3uai/mZGqoYbPqzaiRpeNc Qby4xc5ABsEevCQqAXedJJeYJIA8xSCnp2EBAzCtyGKw3PVhX+ljpu/bWqo6/Aud1Itv wtfRWhOxZM/dDmk3/UjKsE4fC6mLRGNvvKPhTqBGcq4eJz0FUBYfOcaXDkFPUGFluRSV eZfV29vLdaMqM+WimZqWrPj4Y//RLA/WowNFqFioLb2sx4fJRNnDtNdf7XBPF5xRkwRw GjGuV+b+qg6w5xOD5enJdKb5TMWDjTG5/m/e4X5JQttT3R1rewZ91u+yWz7zh2p+0pV5 TT5A== X-Gm-Message-State: APjAAAU4i1iSBYzNjgQr/0XiNo+dooyGgT4RC+OdDVaoFh433LE6YdLO jiWO54eC4pXmiLuznwAnDYo= X-Google-Smtp-Source: APXvYqxVAkwqESQtYoi+d9dPYs4EIrv52fZw/+jMfxVNbQbZI5BJd1ZPRUSmD+291fv5ka3LvpYZJw== X-Received: by 2002:adf:b60f:: with SMTP id f15mr4047365wre.372.1580371860722; Thu, 30 Jan 2020 00:11:00 -0800 (PST) Received: from [192.168.0.63] (84-75-30-51.dclient.hispeed.ch. [84.75.30.51]) by smtp.gmail.com with ESMTPSA id r62sm5814646wma.32.2020.01.30.00.10.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Jan 2020 00:11:00 -0800 (PST) Message-ID: <8A66CBA5-436F-4889-9262-9495A0340BE2@gmail.com> Content-Type: multipart/alternative; boundary="Apple-Mail=_3C99AAF3-17CD-4512-A06E-252F3105C456" Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3608.40.2.2.4\)) Date: Thu, 30 Jan 2020 09:10:59 +0100 In-Reply-To: Cc: Marco Pivetta , tyson andre , "internals@lists.php.net" To: bishop@php.net References: <244D810D-4C45-4D02-A0B7-E625090C19A9@gmail.com> X-Mailer: Apple Mail (2.3608.40.2.2.4) Subject: Re: [PHP-DEV] [VOTE] declare(function_and_const_lookup='global') From: claude.pache@gmail.com (Claude Pache) --Apple-Mail=_3C99AAF3-17CD-4512-A06E-252F3105C456 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > Le 29 janv. 2020 =C3=A0 22:11, Bishop Bettini a = =C3=A9crit : >=20 > On Wed, Jan 29, 2020 at 3:12 PM Claude Pache > wrote: >=20 >=20 >> Le 29 janv. 2020 =C3=A0 19:42, Bishop Bettini > a =C3=A9crit : >>=20 >> Cons... have to enumerate everything, potentially lots of work to do = that >> to update old code to use; edge cases I'm not thinking about. >=20 >=20 > Not only it is much work (although it could be partially automated), = but it does not make much sense. >=20 > I=E2=80=99ve taken a random file (~650 LoC) in the codebase I=E2=80=99m = working on. With `declare(strict_qualify=3D1)`, I would have to add: >=20 > use function=20 > array_filter > , array_flip > , array_key_exists > , array_keys > , array_push > , array_unshift > , compact > , ctype_digit > , idate > , in_array > , is_int > , is_string > , ksort > , ob_get_clean > , ob_start > , preg_match > , sprintf > , strlen > , strncmp > , substr_count > , trim > , usort; >=20 > A fair critique. Under the "goad use of wildcard import" pro, the = quick way: > use \{*}; As of today, we already have something like `use function *`. We name it = =E2=80=9Cfallback to the global scope=E2=80=9D. The current RFC proposes an alternative approach, with its own = advantages and inconveniences. >=20 >=20 > Second, and I find this the best reason, that enumeration tells me = quite a bit about what that code does. I don't need to see the code to = know that it's compute oriented, doesn't touch resources (eg files), and = is doing what PHP does best: string and array manipulation. It also = shows me that code's doing output buffer manipulation, which seems out = of place and suggests that should be refactored out. >=20 > IOW, it's a really nice abstract / summary of what the code's doing. = And that's some very good insight. It=E2=80=99s an illusion: the enumeration of used global functions = doesn=E2=80=99t say all. For instance, you cannot guess if the code = writes on the filesystem by manipulating an instance of `SplFileObject` = (or some other custom class), or not. =E2=80=94Claude --Apple-Mail=_3C99AAF3-17CD-4512-A06E-252F3105C456--