Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:68471 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 18866 invoked from network); 9 Aug 2013 21:43:28 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 Aug 2013 21:43:28 -0000 Authentication-Results: pb1.pair.com header.from=daniel.bingham@ellislab.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=daniel.bingham@ellislab.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ellislab.com designates 209.85.212.48 as permitted sender) X-PHP-List-Original-Sender: daniel.bingham@ellislab.com X-Host-Fingerprint: 209.85.212.48 mail-vb0-f48.google.com Received: from [209.85.212.48] ([209.85.212.48:33213] helo=mail-vb0-f48.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E8/E6-06453-08265025 for ; Fri, 09 Aug 2013 17:43:28 -0400 Received: by mail-vb0-f48.google.com with SMTP id w16so4490162vbf.35 for ; Fri, 09 Aug 2013 14:43:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ellislab.com; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=/6vgVC1qGTFUqMOnRH8yjtoy9I5ammxgO6gGEu0rbdA=; b=WsNnnvuKE2x7JxzMR/bTApNF0vI6kmYTiRSpf804TrE7g/VI4EBBZLh/Idl5qRpcAl 2ayt8ZBAa/K6hf+c9+8Kdxp7Z8YTVxL9n9knhNGtXOePXBbCCQLe3KlN0YFyzk7meWeM OdevyxrVKMIwidJECQN9wSxZ0/+4lid3DryWo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=/6vgVC1qGTFUqMOnRH8yjtoy9I5ammxgO6gGEu0rbdA=; b=hFmSZsLCGTf0ug8canLEkhxpDivFqlzodATfaqzeX75RXd3yHjPZS0YaD8+p0VaxdP j4YIrrO5goGDUMKEPZ1hkXxlBomCSViHJTJ42gNOnWijK/W642m305pu1mTJA+FcyS/M fym7rsU8MtULymA519PJiE4gOkWJEo7UuwQL0g0pA9qq49eiXsHADKx1nSm7vqTruUP8 83jlYiTI+9g1EV9UlhCKv7DfsISrScYWfzdoU3gIXphP6eb19gM9vDaS9tGLIjWJbGDm oOdtX5RZM03Kt7AfAnVSyyrye111UIG+mdRvDiqehnEnE4RsvyEFA34K2hG87nL+/8tf B/zw== X-Gm-Message-State: ALoCoQkoyotCKXyXxCmuEuBxdAh0NyMsyTRZB0xqN4pG8FNA8Cy4Vha8BVDF6sYeafA+YGP/LUBY MIME-Version: 1.0 X-Received: by 10.58.76.74 with SMTP id i10mr1526609vew.13.1376084605877; Fri, 09 Aug 2013 14:43:25 -0700 (PDT) Received: by 10.220.187.66 with HTTP; Fri, 9 Aug 2013 14:43:25 -0700 (PDT) In-Reply-To: References: <60BF8DD5-FEEA-47D9-834F-6C7FDEF3B879@wiedler.ch> <6644FE5E-4CBA-4A08-8766-8634CAA4426D@wiedler.ch> Date: Fri, 9 Aug 2013 17:43:25 -0400 Message-ID: To: Leigh Cc: "internals@lists.php.net" , Igor Wiedler , Michael Wallner Content-Type: multipart/alternative; boundary=047d7b2e432e1d52ec04e38aaa93 Subject: Re: [PHP-DEV] Re: [RFC] Importing namespaced functions From: daniel.bingham@ellislab.com (Daniel Bingham) --047d7b2e432e1d52ec04e38aaa93 Content-Type: text/plain; charset=ISO-8859-1 Hey Leigh, I disagree that it suggests evaluation, but it could easily be a personal interpretation thing. In my interpretation, when looking at use statements, I know nothing is being evaluated. Symbols are being imported into the namespace. How likely is it that baz returns something that can be imported as a symbol? Would that even make sense as a feature, importing the results of an evaluated function? Actually, given those two questions, I can see how it would cause confusion if your initial interpretation is that it is being evaluated. For me, the parenthesis make it easier to read when scanning code. When scanning use statements, I'm not scanning the keywords, I'm scanning the included names. It's easier to look for parenthesis to denote functions, it makes them stand out from the class names more. As in this example below: use foo\bar\baz as baz; use bar\foo\baz() as baz; use bar\baz as bbaz; use baz\foo\bar as bar; use foo\bar() as bar; use baz\bar as bbar; Where as with "use function" I'd have to check back to the beginning of the phrase to determine whether I was looking at a class name or function. use foo\bar\baz as baz; use function bar\foo\baz as baz; use bar\baz as bbaz; use baz\foo\bar as bar; use function foo\bar as bar; use baz\bar as bbar; I think the difference mostly comes down to personal preference, and would be somewhat alleviated by syntax highlighting. Also, I have no knowledge of the PHP parser, so I have no idea how easy or hard this would be to implement. Daniel On Fri, Aug 9, 2013 at 1:16 PM, Leigh wrote: > > On Aug 8, 2013 9:31 PM, "Daniel Bingham" > wrote: > > > > Hey Igor, > > > > I love the RFC, but how about: > > > > use bar\baz() as baz; > > > > As an alternative to "use function". Still new syntax, but a little less > > wordy. > > The parenthesis add the feeling that it should be evaluated imho, I.e. the > result of that function should be used as baz. That could possibly lead to > confusion. I know you're suggesting as an additional syntax not > alternative, but I don't get good vibes from it. > > Also might not even be possible due to how the parser handles parenthesis, > but I'd have to look over the parser grammar to be sure. > > But another +1 from me on the RFC as a whole. Now its there I can't > believe it took so long. > --047d7b2e432e1d52ec04e38aaa93--