views:

235

answers:

5

I was wondering whether it is the intent of the development team of the PHP language to make it into a full fledged statically typed OOP language at some point. Any ideas about this?

Edit:
To add to that: Will this be a performance hit for a non-compiled language? Or are there similar purpose scripting languages that have these capabilities already?

Edit 2:
I meant statically in stead of strong typed; adjusted. Thank you Daniel Pryden for the heads up.

+5  A: 

No chance. Just like there's no plans to turn C# into Ruby because that's basically what you'd be doing: creating a new language. More to the point, strong typing and OO isn't inherently better: it's just different.

If you want a strongly typed OO language, might I suggest Java, C#, even Scala or possibly even C++.

Note: PHP does support objects but it's not a strict OO language like, say, Smalltalk where everything is an object. Even Java/C#/C++ aren't purely OO as they have non-OO (primitive) types.

cletus
PHP OOP changed a lot sinse OOP was introduced in PHP, PHP itself is always changing. I don't think they would do a drastic change, but it is possible to introduce new and optional syntaxes to the language, like the recently introduced types "public", "private" and "protected" for classes.
Havenard
-1. *Static typing* may not be inherently better than dynamic typing. But I think when you start to say that *strong typing* is not inherently better than loose typing, you start to get on very shaky ground.
Daniel Pryden
@Daniel - a) It's called "weak" typing, not "loose", b) What universe do you live in where you would suggest that two opposite concepts are not inherently equal in terms of power/usability/etc?
Chris Lutz
@Chris: (a) Googlefight says "weakly typed" beats "loosely typed", but only by about 3:2. It's not like I just made up the term. (b) Sometimes completely opposite concepts are inherently equal in terms of "power/usability/etc" -- other times they aren't. My opinion is that in this case ("strong" versus "weak" type systems), you can't simply assert that they are equal without providing some rationale. Note that I *didn't* say strong typing *is* inherently better -- I essentially just said "[citation needed]"!
Daniel Pryden
+1  A: 

No, it won't ever be strongly typed. It would turn it into a completely different language, that should not be called PHP any longer.

Further than that, I cannot look into the minds of the PHP team members, so I can't say anything about the real intents they have.

Wouter van Nifterick
+1  A: 

There's no way to answer this question definitely. PHP, unlike most languages, has no explicit roadmap or development process.

Not even the core developers who contribute to the PHP project could tell you the schedule or feature set of any future version of PHP with any accuracy. Even this policy against having policies is unwritten -- it's more of an unspoken culture shared by the loose community who maintains PHP.

So your guess about when or if any specific OO feature such as strong typing will be implemented in PHP is as good as anyone's.

Bill Karwin
+4  A: 

Careful. "Strongly typed" is a vague term that means different things to different people. "Statically typed" is a very specific thing. You can have "strong dynamic" (e.g. Python) and "loose static" (e.g. C, with type punning) systems.

Most of the responses here are assuming you're asking if PHP will ever become a statically typed language. I agree with the other responses -- it is highly unlikely that PHP will ever become a statically typed language.

However, PHP is also not currently very strongly typed, either. "Automatic type conversion" is one of the worst features in any language, IMHO. As to whether PHP will ever become a strongly typed (i.e. with a "sound" type system) dynamic language -- well, it's not a complete impossibility. But I wouldn't hold my breath. Especially when most of the PHP community doesn't even understand the difference anyway, what would be the point?

Daniel Pryden
+1 for your point about the PHP community. Though it doesn't seem to hinder software dev in PHP.
Yar
Daniel, you're absolutely right. I meant statically typed off course.
fireeyedboy
A: 

If you want to know the intents of the PHP team, you can check out their meeting notes:

http://www.php.net/~derick/meeting-notes.html

This was back in 2005, which gives you an idea how slow development can be. Some things like named parameters, delegates would be useful, but they say they won't be doing that. A lot of desirable changes to PHP are being made, but no, it won't become a strongly-typed or strictly OO language.

Tesserex