Re: PHP 6 : a new API ?
On 02/19/2013 11:22 PM, Klaus Ufo wrote:
> Hi there !
>
> We all know that the current PHP API has flaws. Maybe we could use namespaces to build a new
> coherent PHP API ? Like :
>
> - \arr
> - \num
> - \str
>
> and so on. Advantages :
>
> - no more global functions
> - separation of concerns
> - backward compatibility
> - work can be done progressively
> - easy to add user-defined functions (using php namespaces)
> - we could provide a \str\utf8 namespace
>
> This is just an idea. I don't know what is your vision for a next PHP 6.
>
> KH
>
I'm aware people complain about PHP flaws, but having misc global core functions for strings,
arrays and other data types is a new one.
I am still a purest at heart and don't see the need for namespacing in general. I am thinking
it provides some lower level memory space improvements and less conflicts, but I feel like if you
can't code in global space perhaps you should be rethinking how you code. I don't think
most people care about the lower level advantages, they're just looking at it from a code
laziness perspective.
Why make \bar\baz\foo() or $bar->baz->foo() instead of bar_baz_foo()? Prefixing functions
seems perfectly effective. I see a lot of code that looks like they're using namespaces or OO
just to group things together and organize code in some fashion. Not because there's any
inherent benefit.
I'd much rather see effort taken on renaming functions to be more consistent, and making
needle/haystack consistent, and maybe throw in named parameters.. PHP is getting too complex as it
is.
Signed,
PHP purest at heart, (who has code that has lasted for a decade and multiple major php code changes
still did not break it)
Thread (9 messages)