Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62185 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 27757 invoked from network); 15 Aug 2012 11:09:36 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Aug 2012 11:09:36 -0000 Authentication-Results: pb1.pair.com smtp.mail=dragoonis@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=dragoonis@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.161.170 as permitted sender) X-PHP-List-Original-Sender: dragoonis@gmail.com X-Host-Fingerprint: 209.85.161.170 mail-gg0-f170.google.com Received: from [209.85.161.170] ([209.85.161.170:44928] helo=mail-gg0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 6E/86-30529-F638B205 for ; Wed, 15 Aug 2012 07:09:35 -0400 Received: by ggmo6 with SMTP id o6so1770058ggm.29 for ; Wed, 15 Aug 2012 04:09:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=Gz1Bt1T1j3afBqKjG4XmuhrblNLzgFmGWQy9Em5VM74=; b=B0jPG2ZuQo6pktlIp9iVFHZGQ1IFFNN2EvvU/Dzhzz8kOj2S2fOFOc7JwGQRxaniR1 VJSMqi/qvrw3OuxnM6Da0NLLkkzNVcWKuedmuqU761bs0OLAM3H1jYHkWVH0nGkCn2yI YruoU93stq+XHdTbRuY/ndZAuM1ZkrNzDJqzG4t9QIn7i0huyzATtmu6gt3/thQFC2kv 9bcdAq4omo+TXirJuystAsnXqgFYCW6YKqJHKrQUo2VJOi6nWFhZGSBSLDBsvkQw3M7A VsoqUm9DTr4vCnrcl4zvk7vqeo+Hb4auaBdLtQzPwHu4/dOM+u3b5can2WPDTTJNo84K sMCw== MIME-Version: 1.0 Received: by 10.50.163.66 with SMTP id yg2mr17542815igb.3.1345028972674; Wed, 15 Aug 2012 04:09:32 -0700 (PDT) Received: by 10.64.0.108 with HTTP; Wed, 15 Aug 2012 04:09:32 -0700 (PDT) In-Reply-To: References: Date: Wed, 15 Aug 2012 12:09:32 +0100 Message-ID: To: Giedrius Dubinskas Cc: internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] Proposal: use SomeClass::staticMethod From: dragoonis@gmail.com (Paul Dragoonis) Comments inline. On Wed, Aug 15, 2012 at 11:59 AM, Giedrius Dubinskas wrote: > Hello Internals! > > I'm just on and off luker here but thought I'll throw in an idea for a > feature I'd love to see in PHP: aliasing static methods. > > Syntax would look something like this: > > use Namespaced\SomeClass::staticMethod; > use Some\Foo::bar as fooBar; > > staticMethod(); // would call Namespaced\SomeClass::staticMethod() Then you're confusing the reader, they think you're calling a function, but you're actually calling a class method. Confusion++ > fooBar(); // would call Some\Foo::bar() What if a function called staticMethod() already exists, there'd be a bunch of confusion on referring to the right one. > > This would make code more readable, by removing the the noise of > repetition of class names. For use cases we can look at Java use cases > for "import static". When you find a function call, you'd have to scroll up to the top of the page to see if it's actually a method alias. In this case being explicit is a good thing, no scrolling, no confusion. > > Aliasing class constants like that would also be very nice. > > What does everyone think? > Would it be possible in PHP? > > -- > Giedrius Dubinskas Not that I don't welcome your suggestions, I encourage them, but for this paritcular one I vote -1 on it. Thanks. > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php >