Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:124194 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 5834A1A009E for ; Wed, 3 Jul 2024 12:58:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1720011611; bh=OPSthq54YkZzSBeRW4QFR7yyFASKOVfJejuRAkhjWJA=; h=References:In-Reply-To:From:Date:Subject:To:From; b=Yj438e9ak/20zvYiNdUjYf1G6T/ORp9WAo1aWIqBnCcY3UNKCL44uICdzkfTZjn9l O5YzIMN87bw3/1Qs49LbQeQMcjAkS8jyIU26SMpPDnyAePl3M2Orqx/hPgOELHxj1J c7pPbePE39LPFj4F5oHxkyq0Sttek9rFqNWAfukhQn7+V8BtSceak3mlbFAb/OFDR9 qvRVWSl+gV2fgvysfBei6BcpyMmT/iXs77ybYhwKsbzA4De6vi6Xfsy9YjcmjJp1ZJ iTo/TUUMUG9W4p9tjC0ANjA4Zfj/hbfRscW6YPHfu2NflOmfX6vrCsmFn9rufA1o2f 9gZ1POf6qComg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id BC0ED180926 for ; Wed, 3 Jul 2024 13:00:09 +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,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from mail-qv1-f54.google.com (mail-qv1-f54.google.com [209.85.219.54]) (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 ; Wed, 3 Jul 2024 13:00:06 +0000 (UTC) Received: by mail-qv1-f54.google.com with SMTP id 6a1803df08f44-6b4ff803ef2so26559976d6.0 for ; Wed, 03 Jul 2024 05:58:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1720011524; x=1720616324; darn=lists.php.net; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=p0g5/YBZgZaThCdYl2znXgsakr18KfzasGIdjA8Yiy4=; b=N/yBqwa5+XTFD8WqBviBRNyxrIHHqUf65nQHygO+iWS5uRP3v7oUa+heoUVrvBMP33 kmu1Wo5jqq3R/XFK6M1j/BRxzqZdGEbMGCQRuuIqKTSbasMY43LR/0BTuyWACtq8FLiJ Zs/QMbOjMCgr8reFlvZXK+zDQQWo9ZWa3j1zD72MVIgSALkpAxlBIpXITt/w51gnctut INxcrxn6f45jBS5MTx/AHCWqBqgyoZ0dIn5J+33SLQiNCGLfYvZ7ptFLYLoaKih7Lxqr aiulsjo9RCmRVjMEvCEO1oJ4IxbqJKOFitXO0j50LoyyeaX0wjpAuwghrgWWr2P2rsfW SIlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720011524; x=1720616324; h=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=p0g5/YBZgZaThCdYl2znXgsakr18KfzasGIdjA8Yiy4=; b=QT1M+kmSP+caadVkO2iwfEQXDlv0jHigHEiCZLjQXc7Pr/nQ2ck37gShznihCaLY1F OUmmZhMwgLDzkqU0UXmmDvNhT8lO53jn0z0YkgLXmVEiT7zVikK/O9hA5si6GGd4KHB1 IH34WZhsoANQKQVKNbrFVbhWJdLQ4ao4h0tGyKfeLXrRKDjPqtMk666ZE3r13GZOvIJg YixS9fw8XAkrwaesG+de7EvQsH2XPINFQrApHwxITBF9q/fAuUkic2tfCegVN1qEJ5+2 Kk2QDuFzSGDMDVyRRH5ksvx/9ooZV0GAV/lwyNGs+X39BYn/hme0oDYHv1tspzCMwTp4 cNQg== X-Gm-Message-State: AOJu0YyiajqUsBavaWDzXyMnRafgFlnViQigcAtPp6g1sHs89bDn/Rmk ip3g3bcTLvWH/gS7g90uKuu7IRIkEkfBngoYsk5JGXbfoKuMw58gsw+S5kV2cVcoKp9A+AtFuVL +BpKwKQMkuvAIEmQEGg5QDXHNQWRJWk4h X-Google-Smtp-Source: AGHT+IE265SQ6ApfAgRRIre/iMM/WuK6iqRNIg2zK/4tQjXT16LxBNgsPXFmZo8Vfn1XRfSHxLs9JUpgmLGjbVaKLCc= X-Received: by 2002:a05:6214:27ef:b0:6b5:7e97:7151 with SMTP id 6a1803df08f44-6b5b70987f3mr116255906d6.17.1720011523793; Wed, 03 Jul 2024 05:58:43 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 References: <1917CF7C-26D8-4DBE-B05C-5AA650AC6C9F@rwec.co.uk> <551cd5b0-1c00-4818-a9ca-97f6b7e8c3dc@app.fastmail.com> <39B496F8-062E-4848-9B3B-529BE8D3415A@newclarity.net> <856F4F70-DC81-4098-82DD-5F6D47CDF3F0@newclarity.net> <09559430-4477-4516-8D78-6F4071E1AA6C@newclarity.net> <4D45294E-78BA-466A-B2B4-F17BA4E1ED73@woofle.net> <6C3C9DCE-0DC8-4470-AE2B-28E550E08774@miles.systems> <3670820f-1f2f-4a19-9d30-183696e6a852@alec.pl> In-Reply-To: <3670820f-1f2f-4a19-9d30-183696e6a852@alec.pl> Date: Wed, 3 Jul 2024 08:58:32 -0400 Message-ID: Subject: Re: [PHP-DEV] Iteration III: Packages (was Re: [PHP-DEV] [Initial Feedback] PHP User Modules - An Adaptation of ES6 from JavaScript) To: PHP internals Content-Type: multipart/alternative; boundary="000000000000e2ab04061c576399" From: tendoaki@gmail.com (Michael Morris) --000000000000e2ab04061c576399 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Jul 3, 2024 at 7:49=E2=80=AFAM Aleksander Machniak w= rote: > On 3.07.2024 07:32, Richard Miles wrote: > > What if php implicitly prepended namespaces with the composer package > version? > > If two incompatible versions are required, the composer downloads both. > Enabled/Disabled with flag? > > While we're brainstorming... What if something like this would be possibl= e? > > include $file with (strict_types=3D1, scope=3D$prefix); > > Composer would be able to do something useful with that, I suppose. > > I would prefer to leave sleeping dogs where they lie - that is not change how include, include_once, require and require_once work. For one, code imports are never optional, so the two include statements are NEVER appropriate. Second, symbol definitions are never to be done twice, so require is NEVER appropriate. That leaves require_once, and having it behave differently from its siblings is asking for confusion. Hence the reason I'd rather dispense with them entirely and move to a new import mechanism entirely - import. And since it's a new import mechanism it could clean things up that cannot be cleaned any other way. I've tried to stay away from that in the last few emails, but it is there. At a minimum in my opinion, import should be a "code first" importer and not require the file to be imported use


=
On Wed, Jul 3, 2024 at 7:49=E2=80=AFA= M Aleksander Machniak <alec@alec.pl&= gt; wrote:
On 3.= 07.2024 07:32, Richard Miles wrote:
> What if php implicitly prepended namespaces with the composer package = version?
> If two incompatible versions are required, the composer downloads both= . Enabled/Disabled with flag?

While we're brainstorming... What if something like this would be possi= ble?

include $file with (strict_types=3D1, scope=3D$prefix);

Composer would be able to do something useful with that, I suppose.

=

I would prefer to leave sleeping dogs wher= e they lie - that is not change how include, include_once, require and requ= ire_once work.=C2=A0 For one, code imports are never optional, so the two i= nclude statements are NEVER appropriate. Second, symbol definitions are nev= er to be done twice, so require is NEVER appropriate.=C2=A0 That leaves req= uire_once, and having it behave differently from its siblings is asking for= confusion.=C2=A0 Hence the reason I'd rather dispense with them entire= ly and move to a new import mechanism entirely - import.=C2=A0 And since it= 's a new import mechanism it could clean things up that cannot be clean= ed any other way. I've tried to stay away from that in the last few ema= ils, but it is there. At a minimum=C2=A0in my opinion, import should be a &= quot;code first" importer and not require the file to be imported use = <?php to get into code mode. If this means using a separate extension fo= r these files such as phm so that the IDE's can figure it out (and so c= an users at a glance) so be it.=C2=A0 But the behavior of the import statem= ent is parallel=C2=A0to the package issue itself - that is import files cou= ld be nothing special and the package mechanism would still be a feature wo= rth targetting.=C2=A0


=C2=A0
<= /div>
--000000000000e2ab04061c576399--