Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62192 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 48311 invoked from network); 15 Aug 2012 13:52:36 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Aug 2012 13:52:36 -0000 Authentication-Results: pb1.pair.com header.from=d.giedrius@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=d.giedrius@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.213.170 as permitted sender) X-PHP-List-Original-Sender: d.giedrius@gmail.com X-Host-Fingerprint: 209.85.213.170 mail-yx0-f170.google.com Received: from [209.85.213.170] ([209.85.213.170:39531] helo=mail-yx0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 29/21-40941-2A9AB205 for ; Wed, 15 Aug 2012 09:52:35 -0400 Received: by yenm10 with SMTP id m10so1948522yen.29 for ; Wed, 15 Aug 2012 06:52: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=8YLZzE3U42iLZaEHLt1BUIsaMFFYvcStwAEvL7Rqhhc=; b=HO1XmTFFczM7BP3RKxMBRlClMMmMI/AmuHkYmp9Sa7C5TmteBKBeB0z8XpC9YOJYuC BNlcV5Xcs++S9DGeT5lrcpH7nx3GSUeytKBH6W79IFQ77XcX2XibcD6aCJX7apGxEkfg OYdhlfcD77LRZQeK33gNubbEJ1TpVewlCVmpTjhGUkfeAYaNZu/wWCoZy96EexBgZZp4 36/v4gX9vIeEkT6ZIFu4B2KzuUe8pu1QMzIXgAcIXgD1sTM4vQ4EqHPGJNUv6k9RFOXV CZI9hqHe/3qLaqErftU3L41VvcW2MH/NFcFvMqWgd6cgFdhhmC1yw4tDGuZHB6+WI7lt poTw== MIME-Version: 1.0 Received: by 10.50.222.231 with SMTP id qp7mr18821557igc.40.1345038751933; Wed, 15 Aug 2012 06:52:31 -0700 (PDT) Received: by 10.64.136.45 with HTTP; Wed, 15 Aug 2012 06:52:31 -0700 (PDT) In-Reply-To: References: Date: Wed, 15 Aug 2012 16:52:31 +0300 Message-ID: To: Sebastian Krebs Cc: internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] Proposal: use SomeClass::staticMethod From: d.giedrius@gmail.com (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