Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:125118 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 3C70A1A00BD for ; Fri, 23 Aug 2024 10:19:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1724408497; bh=QB1rYp63ce4kRnMGJY31l7vzpXD6EIbBv/x81yw2sVA=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=gAvEmZ/Hc7pRtZIU9U8HRkxpVNqA+X8vGGJ1RoV9SKHIgBIgoqF2Jlh9rz2AV0fTh IFVrA9ZjzJfp2L6iv+YAw2jEDGmrEZ6IJ+nhmZ1Rmnc4oGmv0EoZG/bBUQRne8YUmw KjOJ653j16/4/Mtl+MKVPaedF+HsGIuy7jxUt3fmj0v2KpqoEb1VnQAV3HkLUaHT7E 4PNxhu27wlka57yJlCErjpG8RaQgKuE2leRpNIUKUHcQc989kFmTpbsBunUvcfcOej WtlvJsqiAJlTNLM2R9cQCg8cuHtpha4jnMYu4Pjn+mrmqAnlA1dcVf70Ha1k0GJ2eX PeZYy1qPppuRg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 2BF8218007C for ; Fri, 23 Aug 2024 10:21:37 +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=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, 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 mail-vk1-f175.google.com (mail-vk1-f175.google.com [209.85.221.175]) (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, 23 Aug 2024 10:21:33 +0000 (UTC) Received: by mail-vk1-f175.google.com with SMTP id 71dfb90a1353d-4fce48037f5so613859e0c.1 for ; Fri, 23 Aug 2024 03:19:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724408382; x=1725013182; 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=QB1rYp63ce4kRnMGJY31l7vzpXD6EIbBv/x81yw2sVA=; b=QrOXXpxSpBF6kKnNNLXzYPfFzn/ihirUVGryow5YKyRU2aMo+fMMkV8/v86KqAS+ck UmOR+gHKKb3ecRzgx6yMqN4qSU+sPSleQ0Tl1j/BpdxPiXeDlVp/tWY5cDMfV4JCj5ou qPfihJQFiswCMgHZE+/Tc1OTtVpLZmfzYC3J8wIR8HUALxVpXQ+s/bTDTnCPtYN60LX7 OPzZlQnPd7NKu1igihkRVp+VFr3QFCpW3Yi+CSc9rsOWQsnVt6BKEgzoL9YriNG0BLpV Ts2SYvbBKlFydaGrilSqH+KZhaPOjheQJLKgatnbeLKPtJuF86SvwtzXNmZHcy3BZZ/W yodQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724408382; x=1725013182; 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=QB1rYp63ce4kRnMGJY31l7vzpXD6EIbBv/x81yw2sVA=; b=NKG5vOLHJcdxMNDlL6RTL+fYWwMdFiG2He02P+RNVEx5dwEyTHmMkz1jiQ+kLbrYEd bCZgWHSekFXHNMeAl/bbJNaxlP8Yk0mVgBqpVwNuHW3Nkj5XjT/3wROY9QUi9KBOxMDl TViDxVYx63sA2RfeZR0D2//uN/K6ypxD0eBEhxP/gS41DvyOi5MouBbctaC8zfjjPPlb F+XqhoCT0VUIaPAwGq+uBZsgbKv4hHK9lgVlsGiVRzJpUzjtvONgPb/v8tZAlTjO3TbI wXEoQfk3ngyau/4gno05GbaKeRZryipVDMK9Uewyyu/r+4rh75AQQUH79qMuB3zBvnhY tlpA== X-Forwarded-Encrypted: i=1; AJvYcCWdf/quDBdr/PQbF3w9M1G1F8jRA5Lz6ox2VVm3yTC9BRJezmFirUEgPM6vQvdHYsChnHbHt7Kis68=@lists.php.net X-Gm-Message-State: AOJu0YxzctXMt4MzdpxtCdF1JRDZrExTQutP+dmfJrYzG+GpV/6rL9CG QR8jiTNthTPQPq/ny70lInnKcvvDLK1tlb0PdZhRcr+MBzUrwqk2vE+fnGofqT6khxUWMdWC24d wjmJeUqCbGzaErrMZEWaX3IabIpX9cw== X-Google-Smtp-Source: AGHT+IEnN5V1BnTOICs5UwWaRdx2ECuKMOTvbiNRQGt/4/uiYql6ZJplSXEKWdx6PMQwFRTQ8SYnalN400v3X1/jcZ4= X-Received: by 2002:a05:6122:4706:b0:4ed:52b:dd29 with SMTP id 71dfb90a1353d-4fd1ac89ea9mr1902615e0c.3.1724408381841; Fri, 23 Aug 2024 03:19:41 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 References: <21D6F160-5EAE-44FA-907B-E1DAAC1B8D75@rwec.co.uk> <53BD062A-4D7F-4E5D-852E-6D27641213A8@koalephant.com> In-Reply-To: <53BD062A-4D7F-4E5D-852E-6D27641213A8@koalephant.com> Date: Fri, 23 Aug 2024 11:19:30 +0100 Message-ID: Subject: Re: [PHP-DEV] [Concept] Flip relative function lookup order (global, then local) To: Stephen Reay Cc: "Rowan Tommins [IMSoP]" , PHP Internals List Content-Type: multipart/alternative; boundary="0000000000000c28a50620571d9b" From: dragoonis@gmail.com (Paul Dragoonis) --0000000000000c28a50620571d9b Content-Type: text/plain; charset="UTF-8" On Fri, 23 Aug 2024, 11:02 Stephen Reay, wrote: > > > > On 23 Aug 2024, at 15:29, Rowan Tommins [IMSoP] > wrote: > > > > having global as the default mode (even if we provide an option for > local) is much less disruptive to existing code. > > Hi Rowan, > > I don't disagree with this summary of the current state, but I think this > misses an important factor: namespaced functions are currently nowhere near > as popular as namespaced classes, and a significant part of that is almost > certainly because we don't have function autoloading, nor any kind of > visibility controls for functions (eg package private). > > Making relative function names do the opposite of relative class names > sounds like a great way to permanently kill any prospects of encouraging > developers to use regular namespaced functions in place of static classes > as "bag of functions", which is what we keep hearing we should use - most > notably on a recent RFC to embody the concept of a static class. > > So we're told "no don't use classes for static functions like that, use > proper functions". > > We already can't autoload them which makes them less appealing, and less > practical. > > In a world where global functions take precedence over local ones because > some people don't like writing a single \ character, autoloading would be a > moot point because if you preference global functions you're implicitly > telling developers they shouldn't write namespaced functions, by making > them harder and less intuitive to use. > > > Cheers > > Stephen I've taken the time to carefully read Ilija's proposal and all followup messages. This is a great proposal, Ilija, it will immediately benefit 95%+ userbase. It looks to me that the pro's outweigh the con's, as well as Ilija having done good research here already. As for next steps, I'm suggesting that Ilija reach out to the core team at Symfony, Zend, Laravel as well as WordPress, Magento, Drupal teams .. for their consideration and input, and bring it back here/RFC. The latter group of project's codebases can be quite "quirky", and quite creative, in how they use PHP compared to a traditional "framework". We need to understand how this could negatively impact how their systems are put together, and we definitely want to, upfront, identify anything we wouldn't normally think of, that they can spot, since they know their own codebases better than we do. We already have the composer analysis, so after we have these framework/project analysis then we can make a strongly informed decision on the impact, positively or negatively, this change will make. Many thanks, Paul --0000000000000c28a50620571d9b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Fri, 23 Aug 2024, 11:02 Stephen Reay, <p= hp-lists@koalephant.com> wrote:


> On 23 Aug 2024, at 15:29, Rowan Tommins [IMSoP] <imsop= .php@rwec.co.uk> wrote:
>
> having global as the default mode (even if we provide an option for lo= cal) is much less disruptive to existing code.

Hi Rowan,

I don't disagree with this summary of the current state, but I think th= is misses an important factor: namespaced functions are currently nowhere n= ear as popular as namespaced classes, and a significant part of that is alm= ost certainly because we don't have function autoloading, nor any kind = of visibility controls for functions (eg package private).

Making relative function names do the opposite of relative class names soun= ds like a great way to permanently kill any prospects of encouraging develo= pers to use regular namespaced functions in place of static classes as &quo= t;bag of functions", which is what we keep hearing we should use - mos= t notably on a recent RFC to embody the concept of a static class.

So we're told "no don't use classes for static functions like = that, use proper functions".

We already can't autoload them which makes them less appealing, and les= s practical.

In a world where global functions take precedence over local ones because s= ome people don't like writing a single \ character, autoloading would b= e a moot point because if you preference global functions you're implic= itly telling developers they shouldn't write namespaced functions, by m= aking them harder and less intuitive to use.


Cheers

Stephen


I've taken the time to carefully read Il= ija's proposal and all followup messages.

This is a great proposal, Ilija, it will immediately = benefit 95%+ userbase.

I= t looks to me that the pro's outweigh the con's, as well as Ilija h= aving done good research here already.=C2=A0

As for next steps, I'm suggesting that Ilija reach= out to the core team at Symfony, Zend, Laravel as well as WordPress, Magen= to, Drupal teams .. for their consideration and input, and bring it back he= re/RFC.

The latter group= of project's codebases can be quite "quirky", and quite crea= tive, in how they use PHP compared to a traditional "framework".<= /div>

We need to understand ho= w this could negatively impact how their systems are put together, and we d= efinitely want to, upfront, identify anything we wouldn't normally thin= k of, that they can spot, since they know their own codebases better than w= e do.=C2=A0

We already h= ave the composer analysis, so after we have these framework/project analysi= s then we can make a strongly informed decision on the impact, positively o= r negatively, this change will make.

Many thanks,
Paul

--0000000000000c28a50620571d9b--