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 <[email protected]> > 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 <[email protected]> > 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 <[email protected]> > > > >> On Wed, Aug 15, 2012 at 12:59 PM, Giedrius Dubinskas > >> <[email protected]> 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 >
