Re: [PHP-DEV] [PATCH] array_get()

2007-09-13 Thread Andrew Shearer
On Sep 12, 2007, at 2:25 PM, Lukas Kahwe Smith wrote: Andrew Shearer wrote: Meanwhile, array_get() provides the most-needed functionality while avoiding the issues that prevented ifsetor's acceptance. Aside from lack of BC hacks what is the issue? I remember some fussing about the name,

Re: [PHP-DEV] [PATCH] array_get()

2007-09-13 Thread Peter Brodersen
Hi, On Wed, 12 Sep 2007 20:25:39 +0200, in php.internals [EMAIL PROTECTED] (Lukas Kahwe Smith) wrote: Aside from lack of BC hacks what is the issue? I remember some fussing about the name, but I find this a joke of an argument. You cant get much clearer a name than ifsetor(). just my opinion

Re: [PHP-DEV] [PATCH] array_get()

2007-09-13 Thread Pierre
On 9/13/07, Peter Brodersen [EMAIL PROTECTED] wrote: I'm not too fond of a function that begins with if* - it might misdirect people to think it's a control structure. ifsetor was not a function (like isset). --Pierre -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe,

Re: [PHP-DEV] [PATCH] array_get()

2007-09-13 Thread Marcus Boerger
Hello Andrew, if we go the array_get() route as a short half solution to hopefully make a lot of people happy (at least it would serve $_GET/_REQUEST etc needs). Then I think we should make it a bit more useable: Get the default or the multilevel subscription of $ar proto mixed array_get(array

Re: [PHP-DEV] [PATCH] array_get()

2007-09-12 Thread Marcus Boerger
Hello Robert, yeah ifsetor if much better than the @-?: combination. But for 5.3 that would be all we could do. For 6 and in the long run we might do a real ifsetor. If ever we could come to a consensus... and no i don't really like to restart discussions on ifsetor at this point. marcus

Re: [PHP-DEV] [PATCH] array_get()

2007-09-12 Thread Andrew Shearer
On 9/12/07, Marcus Boerger [EMAIL PROTECTED] wrote: Hello Robert, yeah ifsetor if much better than the @-?: combination. But for 5.3 that would be all we could do. For 6 and in the long run we might do a real ifsetor. If ever we could come to a consensus... and no i don't really like to

Re: [PHP-DEV] [PATCH] array_get()

2007-09-12 Thread Robert Cummings
On Wed, 2007-09-12 at 13:53 -0400, Andrew Shearer wrote: Here is the patch and unit test file for array_get(): http://ashearer.com/software/array_get/2007-09-10-php6/array_get.diff http://ashearer.com/software/array_get/2007-09-10-php6/array_get.phpt And here is the backward

Re: [PHP-DEV] [PATCH] array_get()

2007-09-12 Thread Lukas Kahwe Smith
Andrew Shearer wrote: Meanwhile, array_get() provides the most-needed functionality while avoiding the issues that prevented ifsetor's acceptance. Aside from lack of BC hacks what is the issue? I remember some fussing about the name, but I find this a joke of an argument. You cant get much

Re: [PHP-DEV] [PATCH] array_get()

2007-09-11 Thread Marcus Boerger
Hello Andrew, you can easily implement this function run time. It is not very flexible and far away from what ifsetor was meant to be. Thus I do not think it is a good idea. See comments below. marcus Tuesday, September 11, 2007, 12:12:55 AM, you wrote: Here's a patch against HEAD that

Re: [PHP-DEV] [PATCH] array_get()

2007-09-11 Thread Andrew Shearer
If there's a workable proposal for ifsetor() that fixes the concerns brought up by the original and is likely to go in PHP 6, that would be great. In this case, perfect can be the enemy of good. array_get() helps with many common use cases of ifsetor() while fitting into the the standard

Re: [PHP-DEV] [PATCH] array_get()

2007-09-11 Thread Marcus Boerger
Hello Andrew, did you check out '?:' shortcut in HEAD? php -r 'echo 4?:2;' - 4 php -r 'echo 0?:2;' - 2 best regards marcus Tuesday, September 11, 2007, 3:20:46 PM, you wrote: If there's a workable proposal for ifsetor() that fixes the concerns brought up by the original and is

Re: [PHP-DEV] [PATCH] array_get()

2007-09-11 Thread Andrew Shearer
On 9/11/07, Marcus Boerger [EMAIL PROTECTED] wrote: Hello Andrew, did you check out '?:' shortcut in HEAD? php -r 'echo 4?:2;' - 4 php -r 'echo 0?:2;' - 2 best regards marcus Yes, I had hoped that the ?: operator would solve this. But it doesn't serve the same purpose, because it

Re: [PHP-DEV] [PATCH] array_get()

2007-09-11 Thread Marcus Boerger
Hello Andrew, how about @expression?:default style? Like: $val = $myarray[$key] ?: $default; marcus Tuesday, September 11, 2007, 6:33:42 PM, you wrote: On 9/11/07, Marcus Boerger [EMAIL PROTECTED] wrote: Hello Andrew, did you check out '?:' shortcut in HEAD? php -r 'echo 4?:2;' -

Re: [PHP-DEV] [PATCH] array_get()

2007-09-11 Thread Robert Cummings
On Tue, 2007-09-11 at 18:54 +0200, Marcus Boerger wrote: Hello Andrew, how about @expression?:default style? Like: $val = $myarray[$key] ?: $default; Did you mean like: @$val = $myarray[$key] ?: $default; Because that's an expensive assignment since it will hit the error handler

Re: [PHP-DEV] [PATCH] array_get()

2007-09-11 Thread Andrew Shearer
On 9/11/07, Marcus Boerger [EMAIL PROTECTED] wrote: Hello Andrew, how about @expression?:default style? Like: $val = $myarray[$key] ?: $default; marcus There are drawbacks with using the @ style regularly. One is the lack of error checking: all error messages generated by finding the

Re: [PHP-DEV] [PATCH] array_get()

2007-09-10 Thread Andrew Shearer
Let me try that again with the files attached. I'll leave out the full original proposal this time. On Sep 10, 2007, at 6:12 PM, Andrew Shearer wrote: Here's a patch against HEAD that implements the array_get function previously suggested on this list. I also attached a test suite,

[PHP-DEV] [PATCH] array_get()

2007-09-10 Thread Andrew Shearer
Here's a patch against HEAD that implements the array_get function previously suggested on this list. I also attached a test suite, which should go in ext/standard/tests/array/array_get.phpt. Feedback is welcome. Independently, someone else had posted the same idea as a feature request

Re: [PHP-DEV] [PATCH] array_get()

2007-09-10 Thread Andrew Shearer
I had forgotten that attachments aren't allowed. Here are links to the patch and test suite. This ought to work. Sorry for the multiple posts, everyone. http://ashearer.com/software/array_get/2007-09-10-php6/array_get.diff http://ashearer.com/software/array_get/2007-09-10-php6/array_get.phpt

Re: [PHP-DEV] [PATCH] array_get()

2007-09-10 Thread Arnold Daniels
Hi, Please also add the patch provided by John Bafford last Januari. Arnold Andrew Shearer wrote: I had forgotten that attachments aren't allowed. Here are links to the patch and test suite. This ought to work. Sorry for the multiple posts, everyone.

Re: [PHP-DEV] [PATCH] array_get()

2007-09-10 Thread Antony Dovgal
On 11.09.2007 02:12, Andrew Shearer wrote: Here's a patch against HEAD that implements the array_get function previously suggested on this list. I also attached a test suite, which should go in ext/standard/tests/array/array_get.phpt. Feedback is welcome. Independently, someone else

Re: [PHP-DEV] [PATCH] array_get()

2007-09-10 Thread Andrew Shearer
On Sep 10, 2007, at 10:31 PM, Antony Dovgal wrote: On 11.09.2007 02:12, Andrew Shearer wrote: Here's a patch against HEAD that implements the array_get function previously suggested on this list. I also attached a test suite, which should go in ext/standard/tests/array/array_get.phpt. Feedback