tags:

views:

207

answers:

10

PHP5 has made a real progress, but there's still some lacks, and before all a big mess, in PHP5.

What is the feature you want the most in PHP6?

Some ideas :

  • method overloading in classes
  • variables types in method declarations (not only classes, but basic types as well)
  • multiple heritage
  • unicode
  • cleaning the PHP function mess
  • Friend classes (like in dotnet)

My dream is a "new" separate PHP branch, that would break backward compatibility and become a full programming language

+7  A: 

"Cleaning the PHP function mess"
> I'm guessing you mean the inconsitencies in naming an parameters orders ?

If so, I hope this won't happen : it would be a pain to port scripts/applications from PHP 5 to PHP 6.


A great, and necessary thing, in my opinion, is full Unicode support -- and it's actually the main planned feature of PHP 6.

As a sidenote : it will not be UTF-8, but UTF-16.


"Method override in classes"
> What do you mean by that ? You can already extend classes and re-define methods in the child classes.

A nice thing, though, would be something like Traits -- there are already some discussions going on about that ; see Request for Comments: Traits for PHP


"multiple heritage"
> Not sure that would be such a good idea, actually...

Pascal MARTIN
I'll +1 when I can... vote limit reached!
Ninefingers
Method override in classes : override in the same class ! Like you can in any other language.Cleaning the PHP function mess : you are right this would be a pain, unless they create a "branch", something like a "PHPPro", designed only for professional applications, that can be credible an clean from all the bad image that sticks to PHP
Matthieu
@Matthieu: I think you mean method overloading?
Tom Haigh
@Tom : yes that's it !
Matthieu
+3  A: 

To be honest, I really do want them to fix the inconsistencies [I mean, sometimes they use underlines, sometimes they dont [everything is lowercase too, so its hard to read].... oh, and sometimes its subject-verb, sometimes its verb-subject >_>] Examples: mysqli_real_escape_string, stristr

They might brick current applications, but its for the future. The language isn't going to get any better if they don't do something as simple as standardizing their naming procedures [And to be honest, right now its a mess... thats one of the main criticisms I see for php...]

If you think about it, once code IS ported from php5 to my ideal php6, it will be MUCH MORE straightforward/manageable [in my opinion]. The porting process wouldn't be as hard because you wouldn't have to be confused over whether to use underlines or not, or whether you would have to use verb-subject or subject-verb... It would also make it way easier to learn the c-like language.

I'm just dreaming.

ItzWarty
You mean underscores.
alex
Yea, heh. My bad =P
ItzWarty
A: 

I would guess he means different param signatures for methods. I miss that, sometimes. I've gotten over it using an array. I find it makes for sloppy looking code though, if for instance, in a constructor you have wildly different logic based on different parameter sets.

__construct( $param1, $param2 ){ // Handle case 1 };
__construct( $param3, $param4, $param5 ){ // Handle case 2 };

becomes
  ||
  \/

__construct( $paramArr ){
    foreach( $paramArr as $param ){
       // Do your setting
    }
    // Handle case 1
    // Handle case 2
}

As for function namespace... thats what happens when every library under the sun gets ported over directly from c. Shrug. I find the ol' google php {function_name} often returns the php documentation first thing. What I'd really like is a plugin for eclipse that makes the process of name/paramterization look up a lightning fast operation.

I really, really, really doubt php is going to go typed. I'm not saying I wouldn't mind an optional type hinting to do nice things like help with auto-complete and maybe give me a compiler warning now and again, but bugs of that nature are minimal with the right logging.

Josh
You could use func_get_args(); for handling multiple parameters. But guess you mean something more intelligent.
Ondrej Slinták
A: 
  1. fix inconsistencies in functions naming, arguments orders, etc.
  2. full Unicode support
  3. Multiple inheritance, but agreed with Pascal not sur of interest, perhaps some kind of mixin would have be preferable
Benoit
+3  A: 

The 'slicing' method, as seen on python, will really really be great.

Edit: after the Marius comment (that make my day), this is it:

{} vs []
You can currently use both {} and [] to access string indexes.
But the {} notation will raise an E_STRICT in PHP5.1 and will
be gone totally in PHP6. Also the [] version
will gain substr and array_slice functionality directly -
so you could do "[2,]" to access characters 2 to the end, etc. Very handy.

And i'm loving it.

DaNieL
According to http://www.corephp.co.uk/archives/19-Prepare-for-PHP-6.html in PHP6 you will be able to do $arr[2,] to get the array slice of all elements after the second index. The same can be done on strings to get the substring.
Marius
That's a really cool feature ! Thanks for the info
Matthieu
+2  A: 

I wish they would turn Arrays and Strings into objects with methods attached, so you could, for example, do:

$str = "Hello StackOverflow";
echo $str->length;
$arr = array("one", "two", "three");
$arr->push("four");

I don't see how that would break anything, as they could still keep the old functions for manipulating strings and arrays.

Marius
i think will be messy to have a function to retrieve the string lenght and an method to do the same.. i'll prefer to have the object syntax too, but only if the old function syntax would be removed (and i dont think they will, for backwards compatibility)
DaNieL
yeah, just another inconsitent approach to the language, for sure.
dusoft
Then why not a PHP branch for "pro" developper, breaking backward compatibilityOr maybe should i switch language :(
Matthieu
adding anther branch means that the branch must be supported as well as the 'normal' php6... not very reliable i suppose.PHP6 is been declared as a main version, that will have many backards uncompatibily with the previous versions... after all, php5.3 IS a 'middle-release' between php5 and php6 ;)
DaNieL
A: 
  • overrides
  • type definitions (of both functions and variables)
  • partial classes
  • LINQ!!!
  • lambdas
Ondrej Slinták
Partial classes ? Lambdas ?
Matthieu
Yep, same thing as was introduced in .NET. Lambda expressions: http://msdn.microsoft.com/en-us/library/bb397687.aspx; Partial classes: http://msdn.microsoft.com/en-us/library/wa80x488%28VS.80%29.aspx
Ondrej Slinták
A: 

The current casting support in PHP hasn't changed since... forever?

All we have to play with is:

(string) (integer) (array) (object) (float) ... any others?

A feature I would love to see is custom casting

Sarfraz
+1  A: 

If we consider "shipping" as a feature, that would be my #1. Wonder if Perl 6 or PHP 6 comes first?

Apart from that, removing register_globals and safe mode is awesome and overdue.

Michael Stum
A: 

UTF-8 support for sure. Getting UTF-16 will be great, but I'm currently using UTF-8, so that would be even better. Though I guess I'll look at leaving UTF-8 for UTF-16 if the latter gets support and the former doesn't...

Adrian Schmidt