Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:101175 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 82030 invoked from network); 28 Nov 2017 03:38:24 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Nov 2017 03:38:24 -0000 Authentication-Results: pb1.pair.com header.from=tendoaki@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=tendoaki@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.161.172 as permitted sender) X-PHP-List-Original-Sender: tendoaki@gmail.com X-Host-Fingerprint: 209.85.161.172 mail-yw0-f172.google.com Received: from [209.85.161.172] ([209.85.161.172:42197] helo=mail-yw0-f172.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 9C/CE-26862-B2ADC1A5 for ; Mon, 27 Nov 2017 22:38:19 -0500 Received: by mail-yw0-f172.google.com with SMTP id j198so12747211ywg.9 for ; Mon, 27 Nov 2017 19:38:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=QP1aBpqTTNu4o7qz78XFy0zM6Gomsnjm4Op3v4oMsxQ=; b=hSh35h10IkV+9GBXzZ/YUR5BcuyIiu9VvUdSfGOEpdnUCmGcr4ti6LR/4UCbSzLtdY tjlS9uudioz4o8SPrIH0xnOk4ThOKK73W25TYIY+nRiDvjWnZpKoWT5eBXjusoCIXlQx 6lAaNXKWe46oLJbwaB4feekuCjXTmA9YsSkd1MSBwl/xXpiBYQ5jo/y1GPk9vekpWHV3 3ARLzsC4DmDj6cSkiPF8530BV3Ei59HdZToVzE7PIwiK2ZvvO1ay2nfVK1ZevZcFYeNQ yXpAxFHW+7/c0F8LzqYKJhjE3fnDaSbbRASccPH3M5+flVrnm4Cshnjl8Cct25IW03iC cDdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=QP1aBpqTTNu4o7qz78XFy0zM6Gomsnjm4Op3v4oMsxQ=; b=plO99G1YHzNrVrxaCyiNxLMwg84cpbef/VfLYYPiQ8GoQlG1bK9IgsJXVop6S4EeLI JFuupAddIfVQ0VS3rX734IBopoFhlmPilPhvjQSXpwqtv1pbsaVsWFv0uwzVouD5Kn2E 96tW0B2HhJZ8gAkIyqfqRim/NQ+HP+oqbl1tg1zYAcat5XMr5zqQNh5c8ZDXxdTYFKgS rtxkqaveGbn0ImS24OEP4bzkc/0Ev0t6Z0yeb/uL3dJlW2UojSX6K+QwJjYMQXXdSz8g 3fsYypIDm4RCwqEpnqjkuRHpQ46YpfQfdemuF9Szn6CKBkLsJPr/y7rKmEzW7c7Lb3Z/ Gcaw== X-Gm-Message-State: AJaThX5Lm2gBImS2Ok63WyWXphaB2q+Cp2I4+CwNRcD6qAcOM18z533U S9Ws7c/TonrQ3zxv2V8N6QoC2+kMTd1fNGzX5Jw= X-Google-Smtp-Source: AGs4zMZPAn2FWGc0SpDGsZe4qbtAljNisHVK3VofRwMxJlNZGufkNHIKuudUpCzED8tVn+Hu4U7YRu1QIjYLZ+DtWvM= X-Received: by 10.129.154.141 with SMTP id r135mr27176151ywg.480.1511840296258; Mon, 27 Nov 2017 19:38:16 -0800 (PST) MIME-Version: 1.0 Received: by 10.37.233.14 with HTTP; Mon, 27 Nov 2017 19:38:15 -0800 (PST) In-Reply-To: <12F58DFE-B842-44FB-ACF6-FB62F4BB1F7A@gmail.com> References: <12F58DFE-B842-44FB-ACF6-FB62F4BB1F7A@gmail.com> Date: Mon, 27 Nov 2017 22:38:15 -0500 Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary="94eb2c0bb534d0d0c3055f02bf57" Subject: Re: [PHP-DEV] Changes in namespace importing From: tendoaki@gmail.com (Michael Morris) --94eb2c0bb534d0d0c3055f02bf57 Content-Type: text/plain; charset="UTF-8" I'm sure the internal coders will correct me if I'm wrong on this, but as I understand it PHP has no notion of packages, yet many calls to modify how namespace importing works seem to be under the illusion that packages exist. This is understandable, packages are namespaces are terms used somewhat interchangeably. However, they aren't the same. In Java, Actionscript 3, and I presume C++ and C# when you import a package you are binding it to the resultant executable the compiler will create. This will affect the size of that executable regardless of how much of the package gets used, or even if it gets used. PHP has packages, but they are compiled in when the interpreter is compiled and set up on the machine. Adding a package in PHP requires redoing that compile step and modifying the php.ini to enable the associated .so file. As for libraries looked up by composer - these are never referenced until they are called for at runtime and the autoloader gets invoked. As a result of this PHP's "namespace" resolution is nothing more than a set of string replace rules done at call time to try to resolve the name to a known class. It's a convenience shorthand for programmers, but a powerful one. Also, it has it's limitations. On Fri, Nov 24, 2017 at 8:21 AM, Rowan Collins wrote: > On 24 November 2017 07:05:52 GMT+00:00, "Khawer ." > wrote: > >We use 'use' keyword to import other namespaces, namespace classes, > >namespace functions, and namespace constants. > > > >Example > >1) use abc; (Import abc namespace) > >2) use abc\ClassB; (Import ClassB from abc namespace) > > Although these are described in the manual as separate types of import, > they are actually the same: they alias a prefix used to rewrite class names > when you mention them. > > If you have a class "One\Two\Test" and a class "One\Two", then "use > One\Two" will allow you to access them as "Two\Test" and "Two", > respectively. https://3v4l.org/nQ7pB > > Similarly, if you alias a prefix with "use Foo as Bar", then "new > Bar\Test" will refer to class "Foo\Test", and "new Bar" will refer to class > "Foo". https://3v4l.org/2r6WN > > So "use class" wouldn't make sense, because that's not actually what > happens. > > Regards, > > -- > Rowan Collins > [IMSoP] > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --94eb2c0bb534d0d0c3055f02bf57--