3 ms·
PHP is not that bad? What other popular language is worse?
by tjogin 15y ago
PHP is not that bad? What other popular language is worse?
- MostAwesomeDude 15y agoLua and JS both come to mind. Neither of them are worse than PHP, but they're right around that same level of (un)usability and number of pitfalls.
- mtogo 15y agoLua, really? Could you provide some examples?
- MostAwesomeDude 15y agoNo basic string manipulation, only RE-based stuff. One-based indices instead of zero-based.
- compay 15y ago> No basic string manipulation, only RE-based stuff It's trivial to write, there are lots of libraries that do this. I've worked on a lot of string processing code in Lua. It's not as easy as Perl or Ruby but it's not by any means hard. > One-based indices instead of zero-based. Other than violating the expectations of people used to other C-like languages, this is not in any way even remotely a problem. I don't know anybody who's spent any significant time with Lua who regards this as more than a minor detail.
- MostAwesomeDude 15y agoThese are pitfalls and usability concerns. Languages that make you actively work against the nature of the language are not good; programming languages should be making this stuff easy. One-based indices stop being a "minor detail" as soon as you realize that out-of-bounds indexing doesn't fail, but returns nil. Time to re-examine all of your code. Combine this with the natural mathematical awkwardness of one-based indices and it can get really frustrating, really fast. I had to do Lua for some game design stuff a few years ago, and these were the two things which stuck out at me almost immediately and bothered me during the entire ordeal. Maybe I've been spoiled by Python, Perl, Java, C++, C, and other languages, but it's deeply frustrating how wrong Lua is about this.
- compay 15y agoLua is not perfect. But saying you shouldn't use it because of 1-based indexes is an overreaction. > Maybe I've been spoiled by Python, Perl, Java, C++, C, and other languages Probably. :) One of Lua's main goals is to provide a language easy for beginners to use for small tasks. This affects its design in some other rather annoying ways (like for example, variables being global by default rather than local) but they were pretty carefully made decisions. The context of this thread is, "what could be a good replacement for PHP?" I think because Lua aims to be easy for inexperienced programmers, it's a rather good choice, even if some of its characteristics can be surprising or annoying to established developers experienced with other languages.
- MostAwesomeDude 15y agoThese are pitfalls and usability concerns. Languages that make you actively work against the nature of the language are not good; programming languages should be making this stuff easy. One-based indices stop being a "minor detail" as soon as you realize that out-of-bounds indexing doesn't fail, but returns nil. Time to re-examine all of your code. Combine this with the natural mathematical awkwardness of one-based indices and it can get really frustrating, really fast. I had to do Lua for some game design stuff a few years ago, and these were the two things which stuck out at me almost immediately and bothered me during the entire ordeal. Maybe I've been spoiled by Python, Perl, Java, C++, C, and other languages, but it's deeply frustrating how wrong Lua is about this.
- tjogin 15y agoJS has bad parts, but it has good parts as well. And those parts are pretty great. PHP is all bad parts. Easily the most inconsistent, poorly designed language in popular use today.