Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:124233 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 725D11A009C for ; Fri, 5 Jul 2024 18:23:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1720203875; bh=8Q86CeyltTsaqBPZKP9WJUp5n5Ubs4POw1uxa5tVLI0=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=Xae9t9+5d1IfHOc8+Fq+hfdUVnnosVRl76FGrIHTRVK/gh9hTk8P8nS5MSILeveHc W23/wei0+FBob5sE1W0OEFfkz0joe7Fw9ORSgWYQefysgG+OtFNLTVPj/KQ/IGWQuF MKqC+8xxxpSypHyu9Y/BXo7cpLxuvPfpoT0NduaIgKNyWS+d1x5FyZP38S1f0tVY9G 9/80W9ytutPm3E+0QLWPx48lTysStFZUzk1TL+U8d2MwHqm0ySPszzXBqwvJR4Eqyi 1ax6VVm3NiA7LdkUeJeKUqYMTZM86EPB+ux8oApDpO2Ae98evoqaFOs1Hu7gr6geFZ 5pWLVJVALQrqw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id BFB1C180A8B for ; Fri, 5 Jul 2024 18:24:34 +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.8 required=5.0 tests=BAYES_50,DMARC_MISSING, 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 malamute.woofle.net (malamute.woofle.net [74.207.252.100]) (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, 5 Jul 2024 18:24:34 +0000 (UTC) Received: by malamute.woofle.net (Postfix) with ESMTPSA id E57C51F17A; Fri, 5 Jul 2024 11:23:09 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.600.62\)) Subject: Re: [PHP-DEV] [PHP-Dev] Versioned Packagers (Iteration IV) In-Reply-To: Date: Fri, 5 Jul 2024 11:22:58 -0700 Cc: PHP internals Content-Transfer-Encoding: quoted-printable Message-ID: <91E36C29-758B-45E6-9765-5D8337E048A1@woofle.net> References: <09559430-4477-4516-8D78-6F4071E1AA6C@newclarity.net> <0182F3D6-F464-477F-9029-A2D0A8B50C71@koalephant.com> <1AFD7AAE-8BEA-460D-88A8-15BB3D30A775@koalephant.com> To: Michael Morris X-Mailer: Apple Mail (2.3774.600.62) From: dusk@woofle.net (Dusk) On Jul 3, 2024, at 17:16, Michael Morris wrote: > Can PHP support multiple packages without rewriting the whole engine? = I think so, but it isn't trivial, and the side effects need to be = cordoned off so that those who need this complexity can have it while = the beginning and intermediate coders can ignore it just like they = ignore strict comparison operators and strict typing unless a library = they are trying to use foists it on them. I think that focusing on the syntax and tooling for executing these = imports is starting at the wrong end of this problem. The bulk of the = work for this feature is going to be whatever engine changes are = required to support versioning, not the tooling around it. To that end - consider the following. Let's say that two different files = in your project import different versions of package Foo. Foo contains a = definition of the FooBar class, and contains functions which return that = object. 1) If $foobar is one of those FooBar objects, what does $foobar::class = return? Is it the same as the fully qualified name of FooBar (e.g. = "Foo\FooBar")? Does the result differ depending on what file contains = that code? 2) What happens if you try to pass that string back to something like = new $class() or construct a ReflectionClass for it? Does that depend on = the location of the call? What if the call is through something like = PDO::FETCH_CLASS which occurs within the runtime? 3) Within Foo, would it be true that if $x =3D new FooBar(), then = $x::class =3D=3D=3D FooBar::class? Does this differ outside Foo (with an = appropriately qualified name for FooBar)? 4) If those two files both create FooBar objects of their respective = versions, what happens if you try to pass one of those objects to a = function in the file using the "wrong" version of Foo? Does it pass type = checks, and what happens if it does? If not, how does the check fail? 5) What shows up in the output of functions like get_declared_classes()? = Are there multiple instances of FooBar in there for each version? How = are they distinguished from one another?=