Stanislav Malyshev wrote:
> Hi!
>
>> I am mainly baseing myself on the feedback I got at:
>> http://pooteeweet.org/blog/1288
>
> OK, will read through it.
>
>> I think Liz summarized the gripes best (especially the second
>> paragraph is important to note):
>> "I've been using namespaces since then went into 5.3. From my
>> experience functions in namespaces are basically unusable (you can't
>> alias in a function like you can a class from a namespace - plus
>> there's the ambiguity issue with static methods).
>
> Ambiguity seems to be unavoidable, unfortunately - that's why initial
> version didn't have functions. But I'm not sure about "alias in" comment
> - what exactly is meant here? Did you understand it?
If you have
<?php
namespace Foo::Bar;
class MyClass {}
?>
you can have it "feel" like it's in the current namespace
<?php
use Foo::Bar::MyClass as MyClass;
new MyClass;
?>
You have a function
<?php
namespace Foo::Bar;
function myfunction() {}
?>
<?php
use Foo::Bar::myfunction as myfunction;
myfunction();
?>
This doesn't work at all
The closest you can do is
<?php
use Foo::Bar as F;
F::myfunction;
?>
which kind of defeats the purpose of having functions in namespaces at
all, why not just use a class with static methods at this point.
Thanks,
Elizabeth
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php