Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:72596 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 17748 invoked from network); 14 Feb 2014 13:09:34 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Feb 2014 13:09:34 -0000 Authentication-Results: pb1.pair.com smtp.mail=ingwie2000@googlemail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ingwie2000@googlemail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain googlemail.com designates 74.125.83.45 as permitted sender) X-PHP-List-Original-Sender: ingwie2000@googlemail.com X-Host-Fingerprint: 74.125.83.45 mail-ee0-f45.google.com Received: from [74.125.83.45] ([74.125.83.45:52427] helo=mail-ee0-f45.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A1/91-09381-C851EF25 for ; Fri, 14 Feb 2014 08:09:33 -0500 Received: by mail-ee0-f45.google.com with SMTP id b15so5664094eek.32 for ; Fri, 14 Feb 2014 05:09:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=sqO0L9fqYpfVLXyBESMaJrv8qAZMVrATEHBZKg3kq10=; b=PZdd4OSeUP4atNueGDOUGc6eYHCuOtpaZ/vB7IJzxBk9xYj439hM2oCVE6On+oFEJg 4BjQbEQMCqTM6RCxcoOFVyRCwOvPL50TDJng4WmsmgXcgRML2bp6QtqW4tTjqy9ETuHw ClCKThqzZ+734rmkBKy1h1IpuidEP6xbmlsCAnymY3LFP9+YBSZSR1ZjN72pwSrVKlBo 7ukqIL76RPJsQTY2jjnrgq1pxBgOQmpKc9qTw6GLqXBVwvdBwbneyUfvUKoS01jwxIZD 4IRftUedSf+PqE89NYJDffNePXP5sdXEBae+PdqmEEhxI+2fxnBrewnrfqTLe5AZUe1j VjHQ== X-Received: by 10.14.203.197 with SMTP id f45mr334721eeo.90.1392383369465; Fri, 14 Feb 2014 05:09:29 -0800 (PST) Received: from [192.168.200.19] (dslb-088-068-169-060.pools.arcor-ip.net. [88.68.169.60]) by mx.google.com with ESMTPSA id j42sm19686198eep.21.2014.02.14.05.09.28 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 14 Feb 2014 05:09:28 -0800 (PST) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.0 \(1822\)) In-Reply-To: Date: Fri, 14 Feb 2014 14:09:26 +0100 Cc: internals , Sebastian Krebs Content-Transfer-Encoding: quoted-printable Message-ID: <3B2D0F80-FACF-4D6E-A11F-28009F5ED0FE@googlemail.com> References: <1373879683.17031.4.camel@guybrush> To: Giuseppe Ronca X-Mailer: Apple Mail (2.1822) Subject: Re: [PHP-DEV] PHP proposal on modular systems From: ingwie2000@googlemail.com (Kevin Ingwersen) If we could just override the require function, so we would be able to = mimic the behavior of pytons import, and nodejs=92 require. Porting the = architecture is rather easy, but without being able to override = functions such as require, this is going to be harder. Actually, this is an idea for an RFC i was thinking about=85 o.o; Thing = is just, I dont know how to mod the core to allow overriding of the = require function. Kind regards. Am Fr. Feb. 14 2014 13:53:37 schrieb Giuseppe Ronca: > Sorry for "necroposting" but i would bumping this because since = package > managers such as composer/bower etc. are growing , the hell of > dependencies conflicts is increasing proportionally. >=20 > here you are other examples: >=20 > = http://stackoverflow.com/questions/12656982/resolving-dependency-hell-with= -composer >=20 > = http://stackoverflow.com/questions/15256416/symfony2-how-solve-two-bundles= -requirements-conflicts-when-using-composer >=20 > it's a real problem and not always caused by "bad programming". >=20 > i think that the language itself must offer a solution in this case ( = see > javascript and no-conflicts techniques ) >=20 > so , as explained in my first post, namespaces could be a nice = solution if > they can be nested or dynamically added in some way. >=20 >=20 > 2013-07-17 0:29 GMT+02:00 Giuseppe Ronca : >=20 >> Sorry , i think you're misunderstanding the main concept of this = proposal >> .. >>=20 >> take a look at this post: http://news.php.net/php.internals/68118 it >> explains how you could solve this problem using namespace. >> You can actually have 2 version of the same library loaded inside = same >> process . But namespacing libraries ,using version number encoded in >> namespace, is not a common technique...and manually namespacing = libraries >> is often a long job. >>=20 >> It could be solved by precedent language features IMHO i've exposed. = And >> many people can gain on this.. Composer too. >>=20 >>=20 >> 2013/7/16 Giuseppe Ronca >>=20 >>> You can have multiple objects from the same type in different >>>> implemenations in the same process? >>>>=20 >>>=20 >>>=20 >>> No i'm not saying it. >>>=20 >>>=20 >>>=20 >>>> What should happen, when I instanciate an object of "test" in = version X >>>> and >>>> pass it to a function, that expect it as version Y? To be = consistent PHP >>>> _must_ trigger an error too, if something from the locally included = file >>>> leaves its scope >>>>=20 >>>> class foo { >>>> public static function bar () { >>>> local_include "test.php" / / file which includes "test" = class; >>>> return new test (); // <-- error here >>>> } >>>> } >>>> Because else it is not a local scope anymore. >>>>=20 >>>=20 >>>=20 >>> the concept as i said is the same of "nesting" a class inside = another ( >>> or dynamically namespacing a file ) >>>=20 >>>=20 >>> if two different components need "Library v1.0" and "Library v2.0" = .. >>> they will probably have same classes and namespaces ( but the code = is not >>> the same ). So how could we use both lib at the same time? = Actually php >>> can't load classes in a scope way so you can't do it in any way on = global >>> scope. >>>=20 >>> nesting dynamically libraries inside a namespace or a class , we can >>> create objects that can be accessed only throught their root >>> namespace/class...something like: >>>=20 >>> new Version1\ExternalLibrary\FooClass(); >>>=20 >>> new Version2\ExternalLibrary\FooClass(); >>>=20 >>> and also Composer will thankyou about it since they can solve >>> automatically problems . >>>=20 >>>=20 >>>=20 >>>> Backward compatibility (or compatibility in general) between = component is >>>> something the plugin maintainer should take care of, not the = language. >>>> Regards, >>>> Sebastian >>>=20 >>>=20 >>>=20 >>> i'm talking about backward compatibility of php version...not = external >>> plugins etc...i think that my idea doesn't require any change to php = apps >>> to adapt their code. >>>=20 >>>=20 >>=20