Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:78888 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 54774 invoked from network); 12 Nov 2014 20:45:33 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Nov 2014 20:45:33 -0000 Authentication-Results: pb1.pair.com smtp.mail=adam@adamharvey.name; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=adam@adamharvey.name; sender-id=pass Received-SPF: pass (pb1.pair.com: domain adamharvey.name designates 209.85.223.171 as permitted sender) X-PHP-List-Original-Sender: adam@adamharvey.name X-Host-Fingerprint: 209.85.223.171 mail-ie0-f171.google.com Received: from [209.85.223.171] ([209.85.223.171:49684] helo=mail-ie0-f171.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 71/00-54468-BE6C3645 for ; Wed, 12 Nov 2014 15:45:31 -0500 Received: by mail-ie0-f171.google.com with SMTP id x19so14505472ier.30 for ; Wed, 12 Nov 2014 12:45:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adamharvey.name; s=google; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=aDgVvuC/VxcC/ryE6SHbdiayHccnJUrqRtuXVBn/+ts=; b=VcXTO5cpPElF/dIhXpGk8+EJTcIO2JKu6kMmS8d1fEfTswR3BystbWT1qTWk5bdx0Z IQB3Buue587TqR5s0Q6vSJFuKbeqWaz5lV+JFxFPctBQwU1He1bUMacwrXdzTe5puusc I4lkGmVKgKQgMZLJiA8L7ZuVqQQE6jFDJDN2A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-type; bh=aDgVvuC/VxcC/ryE6SHbdiayHccnJUrqRtuXVBn/+ts=; b=AxtOEcbX9wQAH6qzZyRyrdEhza/K2tjdT3tzC/esAjQzJTWmUq5D6cnrWGNGCFjYlL kyyCC2aVMQ2EUd6gR/ahR8X6pVQv/2t13pqAZMVHkLx9Z/HcCzQmQL/iZ/HLMsRT8G6R LFl+JHrt0ZdbMQXHj81B4UqdsyyzgmCjollZqvXyoUaVG2C4wzMsqWIfOdJX2H4y/FG1 rn0fF7ma0+g7pQ5I+RSZEL68vm8qqRQC90e6NbdAIBWjUofzaAJ5qZJy2u/TYz78+wpF tnGaKbjPVQnOzA6ZHHutIflZajOsyp8ZXUWe81S9NDwxYammEMs5E7Iy9qjtiMiXAJ1c ikyw== X-Gm-Message-State: ALoCoQnQe4gCcfYesAfI++YwafcXMVi1beVPbvh1wZ52Eu3ejbQYy0BJakBsz275OQhVwhFVZrXd X-Received: by 10.50.3.67 with SMTP id a3mr8062708iga.42.1415825128658; Wed, 12 Nov 2014 12:45:28 -0800 (PST) MIME-Version: 1.0 Sender: adam@adamharvey.name Received: by 10.42.86.129 with HTTP; Wed, 12 Nov 2014 12:45:08 -0800 (PST) In-Reply-To: <001101cffda8$9f56e980$de04bc80$@tutteli.ch> References: <000201cff3b2$37615e50$a6241af0$@tutteli.ch> <001101cffda8$9f56e980$de04bc80$@tutteli.ch> Date: Wed, 12 Nov 2014 12:45:08 -0800 X-Google-Sender-Auth: xr2Mwpl6Y8c9qptjzj8221zWiZ4 Message-ID: To: Robert Stoll Cc: PHP Internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] forbid use declaration outside of a namespace in PHP 7 From: aharvey@php.net (Adam Harvey) On 11 November 2014 04:11, Robert Stoll wrote: >> I always found it very ugly that it is possible to define a use outside of a namespace. Consider the following: >> >> namespace{ //default namespace >> } >> >> use foo\Bar; >> >> namespace test{ >> new Bar(); //error, test\Bar not found } >> >> After some thoughts it is quite clear that Bar is test\Bar and not foo\Bar inside of the namespace test. But consider > the >> following example which is not so obvious: >> >> use foo\Bar; >> namespace test; >> new Bar(); //error, test\Bar not found >> >> The use declaration looks like a normal use declaration at first glance. >> I do not see why we should actually support this "feature" any longer and thus suggest to remove it in PHP 7. > Although, it is >> not a bug (the use declaration is simply ignored as far as I can tell) I suppose it confuses the user. >> Nevertheless, even if we declare it as a "feature" I think it should at least not be a "feature" of the specification > of PHP 7. Sorry, I apparently missed this the first time. Would this mean that this sort of script (where we're using use statements without a namespace) would no longer work? Because that strikes me as an irritating and unnecessary BC break for people who are writing throwaway scripts (with no need to live in namespaces) that pull in namespaced libraries to me. Adam