4 ms·
"keeping the ship from sinking" - surely you are a borad member for Facebook, Badoo, Dailymotion. I appreciate your first hand evidence. Come on, if a handful
by colshrapnel 10y ago
"keeping the ship from sinking" - surely you are a borad member for Facebook, Badoo, Dailymotion. I appreciate your first hand evidence.
Come on, if a handful inconsistent function names is all the problem with PHP to you, let me suggest you to get yourself a good IDE with a code completion feature. You'll forget that "broken stdlib" forever... of course if your aim is to get the job jone, not to slander a language you aren't working with.
- fiedzia 10y agoThat they are inconsistent is one problem. That they are functions is another (in otherwise object-oriented language). That they don't throw exceptions is one more (in a laguage that has them). IDE won't fix any of that.
- colshrapnel 10y agoYou can make them throw actually. set_error_handler("myErrorHandler"); function myErrorHandler($errno, $errstr, $errfile, $errline) { throw new Exception($errstr, $errno); } Is all you need. They are functions - yes. If your first language was fully OOP, then probably PHP is not your language of choice. It doesn't make it bad, though.
- babyrainbow 10y ago>set_error_handler("myErrorHandler"); function myErrorHandler($errno, $errstr, $errfile, $errline) { throw new Exception($errstr, $errno); } Is all you need. So you think boxing all kinds of errors into one generic exception type is a solution to this shortcoming of the language? That sure feels like a 'php' solution. I will give you that. But that ain't pretty (even as a work around), and no, it does not do the job. May be if you don't know how to work with exceptions in the first place, then it might work for you. But you might end up with a code base like this [1] [1] http://stackoverflow.com/questions/3425835/converting-errors-to-exceptions-design-flaw http://stackoverflow.com/questions/3425835/converting-errors...
- fiedzia 10y agoThis will most likely break a lot of existing code. Even if it works, it means I'll be parsing text to figure out what exactly happened (exception not only signal "that something happended", but also "what exactly happened". In languages that use them properly that is). Third, nobody does it. Most importantly, stdlib doesn't do it. All of does make PHP bad for me.
- colshrapnel 10y agoIt it will break BC, then don't use it? You guys are using every dirty trick invented for internet discussions in the last 30 years. You said it dosen't exist. When I showed the way to get it, the agrument should stop this very instant. Instead you started nitpicking on the solution. That's dishonest. And it makes the discussion endless. > Third, nobody does it. This statement of yours clearly states that you have no idea of the actual PHP ecosystem. Every single major PHP framework is routinely doing it.
- fiedzia 10y ago> It it will break BC, then don't use it? So the choice is between insane behaviour, or breaking the code. > Instead you started nitpicking on the solution. That's dishonest. And it makes the discussion endless. Because the problem is unsolvable. You cannot get PHP to behave sanely unless you redo everything it does. If you fix one thing, dozens of other will fall apart. >Every single major PHP framework is routinely doing it. Right, I wasn't aware of this. How do you write libraries for PHP than, you choose between using what's in stdlib as it is and being used within a framework where exceptions are thrown? Support both? Ignore the problem? Or every library makes its own choice how stdlib should behave? Do the frameworks convert strerr and errno into something usable?
- dreistdreist 10y agoYou do realize that they do throw Exceptions? Welcome to PHP 7
- fiedzia 10y agoYou're right, if you enforce it via set_error_handler they do, otherwise they don't. Congratulation for PHP team, they are slowly getting on par with methodology invented in 60's. Any plans for having usable exception hierarchy like every other OOP language with exceptions so that you can actually make some use of them?
- babyrainbow 10y ago>Come on, if a handful inconsistent function names is all the problem with PHP.. I don't know about OP. But it is not just that. Php is a flawed language to its roots. Just think of the community that has tolerated a feature like register_globals for, I don't know, 15 years? What good can you expect from it?
- colshrapnel 10y agoFacebook and Wikipedia?
- babyrainbow 10y agoWhat? No. Just because they were written in Php does not mean that they only exists because of Php. That is more than ridiculous... Also, that was not the question, at all.
- tychuz 10y agoClassic phptard argument. but hey, I'm a php hater, don't mind me, retard
- sctb 10y agoWe've banned this account for continuing to violate the guidelines after we asked you to stop. We're happy to unban accounts if you email hn@ycombinator.com and we believe you'll not do this any more.