LWN.net Logo

What other language can you name...

What other language can you name...

Posted Dec 12, 2011 22:31 UTC (Mon) by khim (subscriber, #9252)
In reply to: Facebook's "HipHop Virtual Machine" released by hingo
Parent article: Facebook's "HipHop Virtual Machine" released

So yeah, PHP could have been better and nowadays it is much better than 3.x series, but if you look at the alternatives, you might appreciate it more.

Are you sure? Out of popular contemporary languages two are the worst by far: PHP and JavaScript. Well, bash is close (if you want to call it "programming langauge").

The problem is not in some language constructs but in the very core of these languages. They were designed to "help" the developer. If construct makes no sense (for example if you try to compare integer and string) then PHP and JavaScript try to do "something sensible". The end result is disaster. When your language can declare that "A == B", "B == C" yet "A != C" or if asseritions "A < B", "B < C" and "C < A" are all true... it's hard to be sure in anything. Well, you can use === exclusively (but this makes PHP similar to bash where natural thing creates problems and proper thing look unnatural), but there are no easy solution to second problem.

JavaScript is necessary evil: it's impossible to do any web programming without JavaScript. But PHP... just say no. Easy and simple.

P.S. You may say that C exhibit similar idiosyncratic behavior when floating point is involved. Sure - but floating point is pretty hard to do right in any language. This is well-known problem with similarly simple solution: use fixed point where you can floating point where you must and be extra careful if you do. In PHP it does not help you much...


(Log in to post comments)

What other language can you name...

Posted Dec 13, 2011 16:54 UTC (Tue) by jmm82 (guest, #59425) [Link]

I have been programming regularly in PHP for the past five years and for web development this is rarely an issue. Every language makes trade-offs and PHP allows quick code to be written that does what you want more often than not. Obviously, I would not want to use PHP for mission critical code, but I also wouldn't want most web developers in the real world writing code in a language like C.

What other language can you name...

Posted Dec 13, 2011 20:31 UTC (Tue) by user337392819 (guest, #75347) [Link]

"Obviously, I would not want to use PHP for mission critical code, but I also wouldn't want most web developers in the real world writing code in a language like C."

Perhaps not, but I *would* like to see more web developers endeavoring to learn and understand C, as that would go a long way towards alleviating your apprehension about using PHP in mission-critical scenarios.

What other language can you name...

Posted Dec 13, 2011 21:06 UTC (Tue) by jmm82 (guest, #59425) [Link]

Please explain what you mean. Maybe mission critical was not the correct word.

What other language can you name...

Posted Dec 14, 2011 9:43 UTC (Wed) by mpr22 (subscriber, #60784) [Link]

From the point of view of a web developer, the website's user-facing functionality isn't just mission-critical, it's the mission.

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds