Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62194 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 51836 invoked from network); 15 Aug 2012 14:00:10 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Aug 2012 14:00:10 -0000 Authentication-Results: pb1.pair.com smtp.mail=krebs.seb@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=sebastian.krebs.berlin@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.170 as permitted sender) X-PHP-List-Original-Sender: krebs.seb@gmail.com X-Host-Fingerprint: 209.85.215.170 mail-ey0-f170.google.com Received: from [209.85.215.170] ([209.85.215.170:52773] helo=mail-ey0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 03/F1-40941-16BAB205 for ; Wed, 15 Aug 2012 10:00:05 -0400 Received: by eaao11 with SMTP id o11so464452eaa.29 for ; Wed, 15 Aug 2012 06:59:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:x-google-sender-delegation:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to :content-type; bh=rOiDN8HgFuaro6nr5UF29C+st2z40hwNAC9riNFERtA=; b=yVT5uhgRT/NZNqn00eGhhEYA62PYNq3HlLm/v1A5SJQ7Z3xnAKQvFhPV895gP2GMdF GWH3bSkVNSXl5mNDfEFhRYbwl/9uE1rmW+BdBdEpllukL2810OGwNJsqYwpB4YMAUwav 6k81AL1pUvlitbhBMWC2LEm8WU4xbce0bGUMS+nVpOu5fRzHSVxA+CrbnNDASqTovb6G 09ggAxDABv1H1bPRSSWqFlLTmM9t5RHvExLwR13CqmUU1YoH13IeQTLbyRU+JFKWD4X0 frg/F7Q2KMJsgl3XRRm2HfEq3Iavp5NAlFSVP2pe3HFxomxnrpzo8r1WqWwX/i/r3/Xu gNSA== MIME-Version: 1.0 Received: by 10.14.209.129 with SMTP id s1mr24603278eeo.24.1345039197181; Wed, 15 Aug 2012 06:59:57 -0700 (PDT) Sender: sebastian.krebs.berlin@gmail.com X-Google-Sender-Delegation: sebastian.krebs.berlin@gmail.com Received: by 10.14.176.73 with HTTP; Wed, 15 Aug 2012 06:59:57 -0700 (PDT) In-Reply-To: References: Date: Wed, 15 Aug 2012 15:59:57 +0200 X-Google-Sender-Auth: zRkBwP13yS6QVQjbYrjqmkvXkbk Message-ID: To: internals@lists.php.net Content-Type: multipart/alternative; boundary=047d7b603a788e997404c74e571a Subject: Re: [PHP-DEV] Proposal: use SomeClass::staticMethod From: krebs.seb@gmail.com (Sebastian Krebs) --047d7b603a788e997404c74e571a Content-Type: text/plain; charset=ISO-8859-1 Hi, This additional "function" seems little bit ... misplaced. :X Why not just use MyFoo\Bar; Bar\baz(); // <-- Would be cool, if this trigger an autloader if required Except, that there is no autoloading everything already works this way. Regards, Sebastian 2012/8/15 Giedrius Dubinskas > Yes that is a very common use case and autoloading functions would > solve that one but my main aim here is readability. And that said I > would also suggest: > > use function Namespaced\foo; > > foo(); // calls Namespaced\foo(); > > ;-) > > -- > Giedrius Dubinskas > > On Wed, Aug 15, 2012 at 2:26 PM, Sebastian Krebs > wrote: > > Hi, > > > > because it fits into the context (even if it's slightly offtopic): Can I > > throw in, that I would like to see autoloading for functions? :) > > > > Regards, > > Sebastian > > > > 2012/8/15 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 > >> > >> -- > >> PHP Internals - PHP Runtime Development Mailing List > >> To unsubscribe, visit: http://www.php.net/unsub.php > --047d7b603a788e997404c74e571a--