Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:125085 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id 26C3F1A00BD for ; Wed, 21 Aug 2024 07:44:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1724226379; bh=U/Wq0eILHzdndh5Ae+sL5/eosSE4NkU2gO2k8Ah+CQM=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=P+HjcjLqJ3BGAaOFlrC3m33D6ycaoWhLGub9K7/v4NBfwh9WTR/fsHopUzK5qGX8U wGyTuIv7Od7hxFPm+fIb0LANOhpPAvs/h7bTdwNRLKO6B5zcqwOFcXRMFi8oqr8hCl bGUkyoEsZWKwSIIv1BdE4Dk6GiULFVdL7wQUboqnSTqHUB1l+yW4BW5cV2JmcJUPf+ feZp5MXWsM6wEMyYGxoZXuhFsi5DgUIhIiS61AzywPz1weCM98VZtCUmHd5hBm+/o/ yKnnhY+LAeyJdjyYHMaMuC5LrGvdVDcXwY+yhiOc2dB/NX3dCDC92bsOOuzY79Uy0W q+nWYFB3io5UA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id D7E21180069 for ; Wed, 21 Aug 2024 07:46:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: * X-Spam-Status: No, score=1.0 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_50, DKIM_INVALID,DKIM_SIGNED,DMARC_MISSING,HTML_MESSAGE,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from sender4-of-o54.zoho.com (sender4-of-o54.zoho.com [136.143.188.54]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 21 Aug 2024 07:46:18 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; t=1724226263; cv=none; d=zohomail.com; s=zohoarc; b=S8m3oZKRt6zDTXHD5HjMkDDRdwSYszw4Ombg1hDjAFSoEFo4DXr4S+/cf1RA38bJla+0IGEyEzT3LOBCPxJCOITgm/7Kt9oCKp7u37DgElGIujnJch0BkO7rm+iVAk54AE24VXVjQQwyptR0gtLQp3Vo6qNA3U57MTG6QtoXfQY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1724226263; h=Content-Type:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=U/Wq0eILHzdndh5Ae+sL5/eosSE4NkU2gO2k8Ah+CQM=; b=eXmTk3nYgPXT9rrEt3OVxAvk76zrMhqP02Fx4xh/FQmYIYNQp89YNT+4RDuG+vR90PhPyRV5XHBn1v6JoyjOQG+dSE1tG5b0FUSvazAuZO70BSDhN2FLX4SrjPViF2HxINTzkFOpgdOPN7hQNrkW4kwfGawU1uBk2t+n2w8g2Po= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=faizanakram.me; spf=pass smtp.mailfrom=hello@faizanakram.me; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1724226263; s=zoho; d=faizanakram.me; i=hello@faizanakram.me; h=MIME-Version:References:In-Reply-To:From:From:Date:Date:Message-ID:Subject:Subject:To:To:Cc:Cc:Content-Type:Message-Id:Reply-To; bh=U/Wq0eILHzdndh5Ae+sL5/eosSE4NkU2gO2k8Ah+CQM=; b=JaYe9Ien0W/LPl5M9E3nDRFCluTAvp2/e3ou1VcMF6aNkoo75WnCUyBdx6Zy0hRJ iBHzkGiXot4ix6h01g+RW7GK3+INc2PzG3MqOhZjoGqk70RM4We0WK1wPV+Q2SEBsCv DqeKtrufhefK3g9dtnxGQe9eWKDba/EDy1F65ugg= Received: by mx.zohomail.com with SMTPS id 1724226260451368.6988830704788; Wed, 21 Aug 2024 00:44:20 -0700 (PDT) Received: by mail-yb1-f182.google.com with SMTP id 3f1490d57ef6-e04196b7603so6937243276.0 for ; Wed, 21 Aug 2024 00:44:20 -0700 (PDT) X-Gm-Message-State: AOJu0YzEdAvjfrofwkvpIQAnBmu1E3e6ybppop6EXoFOqd0iXNu51Wc8 +ghW7frFRJrmoprG/VbG1ee/BTb6xDURO/w6yZfqMjNZ7as7D12/iR13xqgceJQyknUxn7nhQU8 EvjT2R0luyvdyXWfwjbr2sJxROaI= X-Google-Smtp-Source: AGHT+IFwQj125p1B9vsFgZbW4uVSZzXMCxiktNXxtUc8ImLGJ5Y1pQgFI7Ou3yF5JwWhuOlobyBfFp1X7YqFtPEiKCY= X-Received: by 2002:a25:1603:0:b0:e16:26e0:fbb5 with SMTP id 3f1490d57ef6-e166553a205mr1627137276.44.1724226259786; Wed, 21 Aug 2024 00:44:19 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 References: <8B2CA646-5778-4C66-A17C-8A30405A854B@cschneid.com> In-Reply-To: <8B2CA646-5778-4C66-A17C-8A30405A854B@cschneid.com> Date: Wed, 21 Aug 2024 09:44:10 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PHP-DEV] [Concept] Flip relative function lookup order (global, then local) To: Christian Schneider Cc: PHP internals Content-Type: multipart/alternative; boundary="000000000000ba2d9506202cb53a" X-ZohoMailClient: External From: hello@faizanakram.me (Faizan Akram Dar) --000000000000ba2d9506202cb53a Content-Type: text/plain; charset="UTF-8" On Wed, Aug 21, 2024, 9:34 AM Christian Schneider wrote: > Am 20.08.2024 um 17:14 schrieb Levi Morrison >: > > Keep in mind that qualifying > > every global function is annoying but probably can be somewhat > > automated, and will bring better performance. So again, this improves > > the existing code even without upgrading. > > Just to be sure: Would code *not* using namespaces also have to qualify > global function calls? I admit that I somewhat skimmed the discussion so I > might have missed that point. > > The point where I think we disagree is that it improves the code. It may > improve performance of the code (even though I somewhat doubt this has a > *significant* impact on most projects) but it IMHO hurts readability. > Writing the additional \ is less of a problem but as code is read a lot > more often than written I think the additional "line-noise" is something > I'd like to avoid. > > Regards, > - Chris > Hi Chris, You don't have to write additional \, you can add "use function" statements if you prefer that style. It's no different from referencing global classes, they either need to be prefixed with \ or need to have a corresponding "use" statement. Kind regards, Faizan --000000000000ba2d9506202cb53a Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Wed, Aug 21, 2024, 9:34 AM Christian Schneider <= cschneid@cschneid.com> wrot= e:
Am 20.08.2024 um 17:14 schrieb L= evi Morrison <levi.morrison@datadoghq.com>:
> Keep in mind that qualifying
> every global function is annoying but probably can be somewhat
> automated, and will bring better performance. So again, this improves<= br> > the existing code even without upgrading.

Just to be sure: Would code *not* using namespaces also have to qualify glo= bal function calls? I admit that I somewhat skimmed the discussion so I mig= ht have missed that point.

The point where I think we disagree is that it improves the code. It may im= prove performance of the code (even though I somewhat doubt this has a *sig= nificant* impact on most projects) but it IMHO hurts readability. Writing t= he additional \ is less of a problem but as code is read a lot more often t= han written I think the additional "line-noise" is something I= 9;d like to avoid.

Regards,
- Chris

Hi Chris,

You don= 't have to write additional \,=C2=A0
you can add= "use function" statements
=C2=A0if you pr= efer that style.=C2=A0
It's no different from re= ferencing global
classes, they either need to be pre= fixed
=C2=A0with \ or need to have a corresponding &= quot;use" statement.



Kind regards,
Faizan

--000000000000ba2d9506202cb53a--