Linked by Thom Holwerda on Sun 30th Sep 2012 20:15 UTC, submitted by MOS6510
General Development "The ObjectScript is a new programing language that mixes benefits of JavaScript, Lua, and PHP. The ObjectScript has syntax from JavaScript, multiple results from Lua, OOP from PHP and much more."
Thread beginning with comment 537136
To view parent comment, click here.
To read all comments associated with this story, please click here.
RE[2]: Comment by YEPHENAS
by Alfman on Mon 1st Oct 2012 08:29 UTC in reply to "RE: Comment by YEPHENAS"
Alfman
Member since:
2011-01-28

dikatlon,

"Why is PHP so evil?"

s/evil/bad/

Well, having been a regular user since the beginning, I can say without a doubt PHP is superior in all ways to what it largely replaced: ASP. However that's where my praise ends. The language has suffered from inconsistency and poor SE decision making over the course of it's entire history such that the developer qualifications behind PHP are brought into question. PHP has a history of semantic flip flops creating code incompatibilities.

Ignoring the multitude of teething problems which PHP has been notorious for in the past. Here are current gripes that are often cited (in no particular order):

1. Namespace mess. This is all all the evidence one needs to officially declare the developers as certified amateurs. Also every programmer has their own opinions about whether function names should be camel case, abbreviated, underlined, etc, but at least we agree to pick one convention and stick to it. PHP is the only language I know of where standard functions have completely disregarded any kind of standard naming convention. One has to wonder whether they had any future direction at all.


2. Thread safety risks inhibit web hosts from being able to deploy multi-threaded versions of apache.

http://neosmart.net/blog/2008/dont-believe-the-lies-php-isnt-thread...
(I'd appreciate any information about whether they've finally fixed it, but it was still crashing in 2010/11)


3. Unicode.
I'm often called up by clients who find unicode glitches on a website caused by php bugs in handing unicode characters which may have been posted into the database, etc. I replace unicode characters with html equivalents, but unicode should just work these days.


4. Magic quotes.
Stupid, stupid, stupid, stupid...


5. Lack of session concurrency.
I uncovered this this year when I was trying to use concurrent ajax calls to monitor a long running process. One visitor can only have one running script per session. Apache will pass a predefined number of concurrent connections to PHP, but PHP will block them and run them serially. So, the long running process would block all further PHP pages for this visitor until the long running process was complete. This entirely defeated my intended purpose of employing concurrent ajax calls. I ended up writing a C daemon to work around the limitation.

6. Comparison operators
PHP diverges from other dynamically typed languages to use this proprietary syntax.

if (F(x)) {...}
vs
if (F(x)==true) {...}
vs
if (F(x)===true) {...}

PHP's equality personality disorder is a source of bugs and confusion. To make matters worse, we've got expressions like "x>==0".


7. PHP's documentation
Well, PHP documentation is a big plus. I thought it was superb, or so I did before php.net recently injected google search results ahead of it's own function search listings. Why did they do that?? Now I have to scroll through a screen full of irrelevant google listings before I can click on the php.net links I want.

Reply Parent Score: 5

RE[3]: Comment by YEPHENAS
by dikatlon on Mon 1st Oct 2012 08:35 in reply to "RE[2]: Comment by YEPHENAS"
dikatlon Member since:
2005-07-08

You have enlightend me and brought up a lot of things that I didnt think about, but I know them (just forgot), for example that "===" is certainly a very stupid nonstandard way.

So whats the language I should use then?

Reply Parent Score: 1

RE[4]: Comment by YEPHENAS
by Alfman on Mon 1st Oct 2012 09:13 in reply to "RE[3]: Comment by YEPHENAS"
Alfman Member since:
2011-01-28

dikatlon,

"So whats the language I should use then?"

If you don't have your own server at your disposal, then there's no denying that the widespread availability of a language is a compelling reason to use it. For better or worse, network effects have driven me to hypocritically use PHP simply because it's popular with clients.

My own personal projects are more geared towards system programming. But if I were to choose a new web language to learn today it'd be Opa. It seems to be a very welcome radical shift away from the multi-tier approach of SQL/PHP/HTML/CSS/JAVSCRIPT/DOM into a new more convergent paradigm. Not that I can recommend something I have zero experience with it, but I'm never the less extremely interested in what it potentially offers.

My interest in Opa was sparked here on OSNews, actually:
http://www.osnews.com/story/25564/Programming_Opa_Web_Development_R...

Reply Parent Score: 2

RE[4]: Comment by YEPHENAS
by kwan_e on Mon 1st Oct 2012 10:43 in reply to "RE[3]: Comment by YEPHENAS"
kwan_e Member since:
2007-02-18

So whats the language I should use then?


REBOL.

Reply Parent Score: 2

RE[4]: Comment by YEPHENAS
by Soulbender on Mon 1st Oct 2012 23:42 in reply to "RE[3]: Comment by YEPHENAS"
Soulbender Member since:
2005-08-18

So whats the language I should use then?


PL/1

Reply Parent Score: 3

RE[4]: Comment by YEPHENAS
by lucas_maximus on Tue 2nd Oct 2012 04:41 in reply to "RE[3]: Comment by YEPHENAS"
lucas_maximus Member since:
2009-08-18

The popular alternatives on *nix is Ruby or Python with a framework like Django or Ruby on Rails.

If you are a dedicated Microsoft $hill like me, well there is ASP.NET MVC which is equivalent.

Reply Parent Score: 3

RE[3]: Comment by YEPHENAS
by Lennie on Mon 1st Oct 2012 12:15 in reply to "RE[2]: Comment by YEPHENAS"
Lennie Member since:
2007-09-22

5. is depends.

4. is gone in 5.4.

2. that isn't true.

Pretty much every extension that is support on Windows has threading support.

The problem is with all the other extensions which are not supported on Windows.

The cause is 2 fold:
1. the library the extension is using does not support threading
2. on Unix/Linux a large share of Apache users still uses pre-fork of FastCGI. Thus threaded PHP does not gets a lot of testing.

Edited 2012-10-01 12:25 UTC

Reply Parent Score: 3

RE[4]: Comment by YEPHENAS
by Alfman on Mon 1st Oct 2012 18:33 in reply to "RE[3]: Comment by YEPHENAS"
Alfman Member since:
2011-01-28

Lennie,

(Adding back my numbers for context)


2. Thread safety

"2. that isn't true. Pretty much every extension that is support on Windows has threading support."

It is true, at least on linux/apache, I've tested it myself, it was racy (I'm not referring to extensions either). If they've fixed it I'd really like to know from someone who's *thoroughly* tested a more recent version.

"2. on Unix/Linux a large share of Apache users still uses pre-fork of FastCGI. Thus threaded PHP does not gets a lot of testing. "

That's rather circular isn't it? I say we're stuck using pre-fork because of threaded PHP bugs, you say threaded PHP is buggy because we're still using pre-fork.


4. Magic quotes.

"4. is gone in 5.4."

Yea, it represents yet another compatibility breaking change. In a production environment a hosting provider cannot simply update to 5.4 and break all the installations of OS commerce etc, so many providers are still holding back, which is arguably the right thing to do instead of breaking client websites. My provider actually *still* assigns .php to PHP4 for this reason. For PHP5, we can use .php5 files. I suppose they could install PHP5.4 and make us use .php54 files or some .htaccess kludge, but we're only in this stupid situation because of the shortsightedness of PHP developers in the first place.

I am thankful that future code will be free of the magic quotes crap, but we're still in the fallout.


5. Lack of session concurrency.

"5. is depends."

...on what? Take a stock PHP installation, use the stock session handler, and it blocks like a mutex.


I'd hope PHP eventually solves all the technical shortcomings. In the end, it's a "good enough" language, but the mess with namespaces/function names is probably never going away.

Edited 2012-10-01 18:39 UTC

Reply Parent Score: 4