Re: [PHP-DEV] Re: [lists.php] [PHP-DEV] [PROPOSAL]Add second to callback of preg_replace_callback

2013-04-29 Thread Laruence
On Tue, Apr 30, 2013 at 5:53 AM, ALeX wrote: > what about patch preg_replace to accept callbacks? > > example: > preg_replace(array( > "/pattern1(.*)/", > "/pattern2(.*)/" >), >array( >function ($pat) { ... } , > "replace" > ) > , ... ); > Hey: then

Re: [PHP-DEV] [PROPOSAL]Add second to callback of preg_replace_callback

2013-04-29 Thread Laruence
On Tue, Apr 30, 2013 at 1:43 AM, Nikita Popov wrote: > On Mon, Apr 29, 2013 at 6:46 PM, Laruence wrote: > >> Hey: >>there comes a FR: https://bugs.php.net/bug.php?id=64730 >> >>the main idea is, in 5.5 we remove support of 'e' modifier. >> >>then comes a problem, the old codes(a real

Re: [PHP-DEV] property de-referencing

2013-04-29 Thread Rasmus Schultz
The characters was an arbitrary choice, just for the sake of argument. I'm not a C programmer, so I don't have a patch - there is also no RFC, but there is general interest, I'd be happy to write one. On Mon, Apr 29, 2013 at 5:22 AM, Lars Strojny wrote: > Hi Rasmus, > > Am 25.04.2013 um 14:47 s

[PHP-DEV] Re: [lists.php] [PHP-DEV] [PROPOSAL]Add second to callback of preg_replace_callback

2013-04-29 Thread ALeX
what about patch preg_replace to accept callbacks? example: preg_replace(array( "/pattern1(.*)/", "/pattern2(.*)/" ), array( function ($pat) { ... } , "replace" ) , ... ); -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http

Re: [PHP-DEV] [PROPOSAL]Add second to callback of preg_replace_callback

2013-04-29 Thread Nikita Popov
On Mon, Apr 29, 2013 at 6:46 PM, Laruence wrote: > Hey: >there comes a FR: https://bugs.php.net/bug.php?id=64730 > >the main idea is, in 5.5 we remove support of 'e' modifier. > >then comes a problem, the old codes(a real use case see > https://github.com/php/php-src/blob/PHP-5.4/Zend

Re: [PHP-DEV] [PROPOSAL]Add second to callback of preg_replace_callback

2013-04-29 Thread Xinchen Hui
发自我的 iPad 在 2013-4-30,1:09,Remi Collet 写道: > Le 29/04/2013 18:46, Laruence a écrit : > >> so I propose to add a second argument to callback(aim to php-5.5.1), > > Seems a useful fix to this problem (also encounter elsewhere) > >> what do you think(of course, the second argument can also easil

Re: [PHP-DEV] [PROPOSAL]Add second to callback of preg_replace_callback

2013-04-29 Thread Remi Collet
Le 29/04/2013 18:46, Laruence a écrit : >so I propose to add a second argument to callback(aim to php-5.5.1), Seems a useful fix to this problem (also encounter elsewhere) > what do you think(of course, the second argument can also easily change > to be the regex idx in the regex array)?

[PHP-DEV] [PROPOSAL]Add second to callback of preg_replace_callback

2013-04-29 Thread Laruence
Hey: there comes a FR: https://bugs.php.net/bug.php?id=64730 the main idea is, in 5.5 we remove support of 'e' modifier. then comes a problem, the old codes(a real use case see https://github.com/php/php-src/blob/PHP-5.4/Zend/zend_vm_gen.php#L390): preg_replace(array( "/patt

Re: [PHP-DEV] Continued try blocks

2013-04-29 Thread Amaury Bouchard
Why not. But it will come in addition to "resume", not instead of it. Then: - "resume" => continue execution just after the point where the exception was raised. - "restart" => restart the whole try block. I don't understand the meaning of your "rollback". 2013/4/29 Camilo Sperberg > > On Apr

Re: [PHP-DEV] Continued try blocks

2013-04-29 Thread Stas Malyshev
Hi! > this has quite a few issues and feels like abusing exceptions for > regular control flow. > The primary issue is that "throw" is a terminating operation. A I agree. If your code can handle the problem, it should not throw. If it throws, the control should not go back there, since the code a

Re: [PHP-DEV] Continued try blocks

2013-04-29 Thread Camilo Sperberg
On Apr 29, 2013, at 09:25, Amaury Bouchard wrote: > Why not. But it will come in addition to "resume", not instead of it. > Then: > - "resume" => continue execution just after the point where the exception was > raised. > - "restart" => restart the whole try block. > > I don't understand the m

Re: [PHP-DEV] Continued try blocks

2013-04-29 Thread Camilo Sperberg
On Apr 28, 2013, at 17:27, Julien Pauli wrote: > On Sat, Apr 27, 2013 at 3:56 PM, Amaury Bouchard wrote: > >> 2013/4/27 Ferenc Kovacs >> >>> please don't reuse the continue keyword for it. >>> >>> There are a bunch of code out there where which uses exceptions in a loop >>> context. >>> For

Re: [PHP-DEV] property de-referencing

2013-04-29 Thread Lars Strojny
Hi Rasmus, Am 25.04.2013 um 14:47 schrieb Rasmus Schultz : [...] > > What do you think? I'm not sure about the operator character but the general idea is a good one. Do you have a patch as a POC? cu, Lars -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://ww

Re: [PHP-DEV] Continued try blocks

2013-04-29 Thread Ralph Schindler
So, in this example, if, say, bar() throws a SomeException , the code would then resume and execute baz() after the catch block. Just presenting the idea here, no RFC actually , I'm collecting thoughts and notices. It seems like you want application specific flow control (caller specific) wh

[PHP-DEV] Re: [lists.php] Re: [PHP-DEV] Continued try blocks

2013-04-29 Thread ALeX
HI, I also really don't like it. if you have a try/catch within a for, will it continue the try or for? (or have I to use "continue 2" to reach the for) At least use another keyword to make it more clear that you don't want to continue a loop at the beginning but a catch statement after the excep

Re: [PHP-DEV] Continued try blocks

2013-04-29 Thread Johannes Schlüter
On Mon, 2013-04-29 at 08:25 +0200, Lars Strojny wrote: > Hi Julien, > > I'm still on the fence, not sure if it isn’t too opaque. > > Am 26.04.2013 um 16:41 schrieb Julien Pauli : > [...] > > One question regarding scoping: does the next statement inherit the scope of > the catch block like this

Re: [PHP-DEV] Continued try blocks

2013-04-29 Thread Lars Strojny
Hi Julien, I'm still on the fence, not sure if it isn’t too opaque. Am 26.04.2013 um 16:41 schrieb Julien Pauli : [...] One question regarding scoping: does the next statement inherit the scope of the catch block like this? try { $user = $repository->findById(123); $user->setName($name);

Re: [PHP-DEV] Continued try blocks

2013-04-29 Thread Lazare Inepologlou
2013/4/28 Julien Pauli > On Sat, Apr 27, 2013 at 3:56 PM, Amaury Bouchard > wrote: > > > 2013/4/27 Ferenc Kovacs > > > >> please don't reuse the continue keyword for it. > >> > >> There are a bunch of code out there where which uses exceptions in a > loop > >> context. > >> For example you have

Re: AW: [PHP-DEV] Continued try blocks

2013-04-29 Thread Johannes Schlüter
On Sat, 2013-04-27 at 19:46 +0100, Robert Stoll wrote: > I agree with Amaury. > Although, it is rather smelly code to use try/catch as control flow > instrument, in some situations it is clearer to do it this way. > I think the new construct would be especially useful if one just wants to > log e

Re: [PHP-DEV] Continued try blocks

2013-04-29 Thread Johannes Schlüter
On Fri, 2013-04-26 at 16:41 +0200, Julien Pauli wrote: > Hello internals, > > I had an idea recently with a friend, about a feature try-catch blocks > could use. > Let me just write an example, you will quickly understand the idea : > > * * > * > *try {* > * foo();* > * bar();* > * baz();*

Re: [PHP-DEV] Continued try blocks

2013-04-29 Thread Ralph Schindler
I think we should look at swapping out the parser for something more context aware before we start adding more generic keywords that have global symbol ramifications and has name BC implications. There is some code (lots?) out there that has: class SomeClass { public function resume() { ..