Re: Announcing RFC 'Anonymous Catches'

From: Date: Tue, 25 Jun 2013 12:49:58 +0000
Subject: Re: Announcing RFC 'Anonymous Catches'
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-67805@lists.php.net to get a copy of this message
On Tue, Jun 25, 2013 at 12:54 AM, Joost Koehoorn <joost.koehoorn@gmail.com> wrote: > Hi all, > > I just published an RFC that proposes to add catch-statement without needing to specify a > variable, and support for fully anonymous catches. > > Details can be found at: > > https://wiki.php.net/rfc/anonymous_catch > > Regards, > > Joost Koehoorn > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > Hi, First of, considering that you would only save three characters by having the ' $e' removed, I don't see how it would make things easier to learn. I mean if you can't learn that maybe you should look into something else that's not related to programming :) Having this: "* Avoid indication of a specific exception type" could be considered as a possible bad practice, just as you were saying that catch(\Exception $e) is. Also, it you can add the other ten characters that you save when typing \Exception but does it worth it? How do you plan to handle this: * Note that there may only be one anonymous catch-statement, and it has to be the last one. Throw a fatal error? If not then what, nothing? What are the performance downsides of having this check in place? I do understand that you mentioned: "* Runtime needs to perform less checks. No need to update the symboltable, no need to check exception inheritance. " but wouldn't that be replaced by what I'm asking about? If I could read/understand C better I wouldn't ask for this. Could you also please elaborate this: "* Better possibilities for static analysis tools"? As for: * People from other languages such as C#, Python and Ruby expect this to work I think it is often pointed out when requesting features such as function/method return type hinting (I'm planning a RFC for that), named parameters, threads and other stuff that this ain't C#, Java, Python, Ruby or whatnot so.. what's the official position on this? Do we want PHP like the other languages or not (and I won't say more on this here/now)? Also, the code sample is not that good. If you want to reflect a good quality scenario, it should be more like: while (true) { try { $this->connectToServer(); break; } catch (ConnectionFailedException) { sleep(3); } } And I think the RFC should also add a: Disadvantages section so that it could help people looking on it and proving that you've done all the research correctly. Thanks ---- Florin Patan https://github.com/dlsniper http://www.linkedin.com/in/florinpatan

« previous php.internals (#67805) next »