Re: [PHP-DEV] Regarding PHP6, string/array APIs

2012-07-23 Thread André Rømcke
On 7/20/12 2:33 AM, Anthony Ferrara ircmax...@gmail.com wrote: Hey all, So I've been thinking about this for a while. Here's what I've come up with: 1. We want to maintain loose typing, so implementing a different API on string than on int types would be bad. 2. We want to retain backwards

Re: [PHP-DEV] Regarding PHP6, string/array APIs

2012-07-20 Thread Ralf Lang
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 - -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Am 20.07.2012 02:09, schrieb Stas Malyshev: Hi! 2. It would be really useful to have 2 versions of each function: one which mutates the variable and one which returns the new variable. Example:

Re: [PHP-DEV] Regarding PHP6, string/array APIs

2012-07-20 Thread Alexey Zakhlestin
On 20.07.2012, at 4:09, Stas Malyshev wrote: Hi! 2. It would be really useful to have 2 versions of each function: one which mutates the variable and one which returns the new variable. Example: ?php $src = 'SoUrCe'; $result = lowered($src); // $result == 'source', $src == 'SoUrCe'

Re: [PHP-DEV] Regarding PHP6, string/array APIs

2012-07-20 Thread Alexey Zakhlestin
Anthony, the whole concept is interesting. Can you probably write that as RFC. I believe that will make it easier to read/understand it. Right now, I have only one question: On 20.07.2012, at 4:33, Anthony Ferrara wrote: The benefit here, is that user types can implement the same core

Re: [PHP-DEV] Regarding PHP6, string/array APIs

2012-07-20 Thread Stas Malyshev
Hi! I'm not sure I understand why. What's wrong with $src = lowered($src);? That's just convenience. matter of readability. IMHO assignment is always more readable than function with magic unobvious effects. I'd rather always have assignments than scratch my head each time reading the code

[PHP-DEV] Regarding PHP6, string/array APIs

2012-07-19 Thread Alexey Zakhlestin
Stas made a good point about need to start with new API, which then can be followed by syntactic sugar. So, we need some ideas to start with: 1. A lot of people told, that it would be a good idea to come with a written standard regarding arguments order. I don't care what it will be, as long

Re: [PHP-DEV] Regarding PHP6, string/array APIs

2012-07-19 Thread Andrew Faulds
One consideration: Should be a general array/string/int/float/bool API. PHP is weakly typed: therefore, say, reverse() would reverse a string OR an array. negate() would invert a bool, negate an int/float. slice() would slice a section of a string OR an array. max() would find maximum of an array,

Re: [PHP-DEV] Regarding PHP6, string/array APIs

2012-07-19 Thread Stas Malyshev
Hi! 2. It would be really useful to have 2 versions of each function: one which mutates the variable and one which returns the new variable. Example: ?php $src = 'SoUrCe'; $result = lowered($src); // $result == 'source', $src == 'SoUrCe' $result = lower($srd); // $result == true,

Re: [PHP-DEV] Regarding PHP6, string/array APIs

2012-07-19 Thread Anthony Ferrara
Hey all, So I've been thinking about this for a while. Here's what I've come up with: 1. We want to maintain loose typing, so implementing a different API on string than on int types would be bad. 2. We want to retain backwards compatibility to some extent with the legacy API. 3. We want the