Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:94986 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 68921 invoked from network); 10 Aug 2016 08:47:35 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Aug 2016 08:47:35 -0000 Authentication-Results: pb1.pair.com smtp.mail=smalyshev@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=smalyshev@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.192.175 as permitted sender) X-PHP-List-Original-Sender: smalyshev@gmail.com X-Host-Fingerprint: 209.85.192.175 mail-pf0-f175.google.com Received: from [209.85.192.175] ([209.85.192.175:35028] helo=mail-pf0-f175.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D0/ED-03404-62AEAA75 for ; Wed, 10 Aug 2016 04:47:34 -0400 Received: by mail-pf0-f175.google.com with SMTP id x72so14008300pfd.2 for ; Wed, 10 Aug 2016 01:47:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=lXP6w1W00n/nz/v2nqQHjQpaktPjsAZLNGJKLhnMRFw=; b=HblSif0dXg3WQJ9XkvKubZTMbOGApWN0ct5T0YcuXAiG9Iue4qFORaU8m93VtzLVL/ 2gMw6HSmi6ZxDwlT16Qq8yqNz+vIES8XNwUSf8SrEp1ewLaBkIPOz8u5/jJwnYdwUssZ 8Yg5hnSzHFmVf35hMkcUb/zWHxfGQQb9mIWvuL4FBeSizbtHQl2GKrkqZzmUXzMl2QPm bVKG0+Kd5j7rZ9Ntf44hdfyEbaiax24xsdvDKOsN/87Hw39sk1Wv6g6DMlCwYn57nLfK Ehm7jIMFalg/2Wrb1H8mclBnqNtugl2UC48yBBwzCGT5fOvTf9J2C9hT/NMF2uVStw7S gchA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=lXP6w1W00n/nz/v2nqQHjQpaktPjsAZLNGJKLhnMRFw=; b=deIPwwxIIDLKO7aVJcfew0dbgaDtqHcftB4JlCnpRshfsgFf/Phj2qRh0y/IWjO972 zyQ20thCrQ2iuQyUoNjDd6uz3ASCSoSWzH0c4oIdwbQsxoBrv1tqf7l+qruY9970oN6o 6LBquiCwsQ0gfZT3Ept7C9jTej+EJwjAVou5QfmHzMA3OLjVIs4MCYjPsTUE2YNPM7Bm dsRIJ23yFt5K6+Ud+zq2wt8tBNGNLdiKvy9Eyj31TiHORTwdpQxifatftCxpFLoP/Sgw c0bVBObqiTp9a0KeZGHTmfVRNSINDwRfvyj7iceno0CxiPI6Dm4B5kWCbBP9dUxkvSAh /dKA== X-Gm-Message-State: AEkoousEoRwpxNzWH+phujLbEJcK/sriiNg2Luuu4VWks4cINQe8b6omaQkOneolMHHWhA== X-Received: by 10.98.12.18 with SMTP id u18mr5018497pfi.89.1470818851358; Wed, 10 Aug 2016 01:47:31 -0700 (PDT) Received: from Stas-Air.local (108-233-206-104.lightspeed.sntcca.sbcglobal.net. [108.233.206.104]) by smtp.gmail.com with ESMTPSA id lf11sm61970791pab.17.2016.08.10.01.47.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Aug 2016 01:47:30 -0700 (PDT) To: Julien Pauli , =?UTF-8?Q?Micha=c5=82_Brzuchalski?= References: Cc: PHP Internals List Message-ID: Date: Wed, 10 Aug 2016 01:47:30 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Namespaces internal refactoring From: smalyshev@gmail.com (Stanislav Malyshev) Hi! > It is. > > I agree with your thoughts. > Back in 2008, namespaces were designed and added to PHP 5.3 as just > substrings in class names. That is correct (except that namespaces first appeared in 2007, first commit f32ffe9b430b718628f868e449c1fcbdc8ec9ef6 if you're interested, of course were many since then that changed stuff :). However, I do not think what follows is. > That is not the right way to do things, but we had not that much time > to design them otherwise, and we did not want to break the API too > much by adding new structures. > So, namespaces were designed as "just" some substrings in class names, > with all the problems you spot. Designing namespaces as they are was a deliberate design decision, and it was not because we "didn't want to break APIs" or because we did not know better or were afraid of adding another struct, but because it was decided to choose a simple solution that allows to achieve a lot without introducing a lot of complexity. I certainly object to the blanket characterization of it as "not the right way to do things". I took part in the implementation and though it was almost 9 years ago, I think I still remember at least something :) We did consider using something like Java or Python packages, and we decided it's much too complex and not very suitable for dynamic world of PHP where classes and class files can be loaded at any time at any order. I think some people misunderstand this concept and think PHP namespaces are like half-baked Java packages but without some features because we were too short-sighted or too hasty to implement those. No, they are not like Java packages and they are implemented as not being separate entities but being name prefixes very consciously and deliberately. Now, 9 years later, we can reopen this question and think maybe our needs changed and maybe different model would serve us better. This is certainly possible and there's nothing wrong with that. But I think we need to approach it with right understanding of why we took certain decisions and where these decisions come from. It is very wrong to refactor something without understanding why it was built like that in the first place, and without understanding the initial design and requirements. We spent a real lot of time discussing all this stuff, and it'll be a pity if we spend this time again without using our previous experience. I also don't see any need in having "namespace registry", and, in fact, if you understand conceptual model of PHP namespaces as they are now, it doesn't make much sense to me. -- Stas Malyshev smalyshev@gmail.com