Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62186 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 29386 invoked from network); 15 Aug 2012 11:18:58 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Aug 2012 11:18:58 -0000 Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.42 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.215.42 mail-lpp01m010-f42.google.com Received: from [209.85.215.42] ([209.85.215.42:51780] helo=mail-lpp01m010-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A6/E6-30529-1A58B205 for ; Wed, 15 Aug 2012 07:18:58 -0400 Received: by lahl5 with SMTP id l5so791045lah.29 for ; Wed, 15 Aug 2012 04:18:54 -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=YbmnkA6QIfwiJ07pOcmEkI/R5+OMp+Nap/SZJLqVovI=; b=fN2pSZMC/BoiBExEdciJ3FlutLs89bWWTZ+8ZuLiJ5hXr7EN8d6BpjUv/WNNUlzLjg 9bisz+Xq+nCJCM0lmy1EbVFIEN95ZS9tIkwBO6iEkPYCromjZt+twRc6JzqsTXdbLch+ 5GNuFgcxPH7mQmQRgxYdNqewD2vILxzWVLcYqt0PL1Qed6DXgauYRB5LPB5F+FzlSeBx Ek5bJ/GQm0EGR+CXVoPj7dlHQVj0/k/9rGpFlRuEAxbgjbpmwjOfNF9LlP5W/pLe8p63 tsDMqiRwV4joFdclTGcs455lroSzR+Cbdo1RUCnng3jztNA1DiAoeyDVZL6rJp+Tv3rR qL2A== MIME-Version: 1.0 Received: by 10.152.144.234 with SMTP id sp10mr18809379lab.51.1345029534163; Wed, 15 Aug 2012 04:18:54 -0700 (PDT) Received: by 10.152.122.51 with HTTP; Wed, 15 Aug 2012 04:18:54 -0700 (PDT) In-Reply-To: References: Date: Wed, 15 Aug 2012 13:18:54 +0200 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: nikita.ppv@gmail.com (Nikita Popov) On Wed, Aug 15, 2012 at 12:59 PM, 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() > fooBar(); // would call Some\Foo::bar() > > 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". > > Aliasing class constants like that would also be very nice. > > What does everyone think? I have the suspicion that you are just using static methods as a way to group functions into a "namespace". If that's what you want, then why not just use namespaced functions for that? Should be a lot less confusing and also semantically more correct. Nikita