Live data from Hacker News

What PHP 5.5 might look like

nikic.github.com

11–20 of 139 posts

Re: What PHP 5.5 might look like

#11

No matter how much PHP is improved upon, until there is a serious contender framework for it like Rails or Django, PHP will continue its route to extinction. Dinosaurs were once big and powerful. They dominated the landscape. They don't exist anymore.

This is also the year of the Linux Desktop.

Re: What PHP 5.5 might look like

#12
post #4
post #2

Pretty exciting, though empty() should be deprecated, not improved upon. The bit about getting the fully qualified class name is important, but it still prevents you from doing something like: function builder_factory( $var ) { $class = $some_array[ $var ]; return new $class(); } So you have to write a ton of boilerplate for something that used to be easy without namespaces, or write namespace traversal into your PHP…

Better than parameter skipping would be named parameters so you could just do: function foo($a, $b="10", $c="5", $d="3") { /* .. */ } foo(5, $c="10"); That way $a == 5, $b == "10", $c == "10", and $d == "3". Much better and cleaner syntax in my opinion and a lot of other languages support something similar.

That's exactly what I was going to say.

The author says this about parameter skipping:

   Personally I’m not particular fond of this proposal. 
   In my eyes code that needs this feature is just badly
   designed. Functions shouldn’t have 12 optional parameters.
I'm not fond of this proposal either, for it doesn't solve a problem named parameters do, which is that sometimes function parameters don't have a logical order, and cramming them into an array feel sloppy as hell.

Re: What PHP 5.5 might look like

#13

No matter how much PHP is improved upon, until there is a serious contender framework for it like Rails or Django, PHP will continue its route to extinction. Dinosaurs were once big and powerful. They dominated the landscape. They don't exist anymore.

The beauty of PHP is that it is simple to learn and easy to setup. That is why it is popular and will continue to be. Additions, such as the easy-to-use password encryption, are brilliant because it will make it even easier to move from adding some dynamic functionality to building a full app.

Re: What PHP 5.5 might look like

#14
post #6

The introduction of list comprehensions is nice and should replace numerous functions. For example, I'm not sure why they're adding the array_column function into PHP 5.5 at the same time as list comprehensions as: $names = array_column($users, 'name'); // is the same as $names = [foreach ($users as $user) yield $user['name']]; The only possible reason would be due to a significant speed difference, but I'd suggest i…

I, for one, never understood why there was no "default" keyword available, but the python example is great as well.

About the rest of the article :

- the modified empty() is nice, while I still think this function accepts to much thing as empty, or at least should be more flexible.

Getter/setter : finally. Now I don't get why there is no readonly keyword which would put the variable as readonly only for the class' outer world.

Re: What PHP 5.5 might look like

#15
post #2

Pretty exciting, though empty() should be deprecated, not improved upon. The bit about getting the fully qualified class name is important, but it still prevents you from doing something like: function builder_factory( $var ) { $class = $some_array[ $var ]; return new $class(); } So you have to write a ton of boilerplate for something that used to be easy without namespaces, or write namespace traversal into your PHP…

I'm curious: Why do you think empty() should be deprecated? Do you think the same of isset?

Re: What PHP 5.5 might look like

#16

No matter how much PHP is improved upon, until there is a serious contender framework for it like Rails or Django, PHP will continue its route to extinction. Dinosaurs were once big and powerful. They dominated the landscape. They don't exist anymore.

There are many that come to mind CodeIgniter, CakePHP, Kohana, etc... are pretty damn good.

Re: What PHP 5.5 might look like

#18
post #6

The introduction of list comprehensions is nice and should replace numerous functions. For example, I'm not sure why they're adding the array_column function into PHP 5.5 at the same time as list comprehensions as: $names = array_column($users, 'name'); // is the same as $names = [foreach ($users as $user) yield $user['name']]; The only possible reason would be due to a significant speed difference, but I'd suggest i…

I agree with you on using keyword arguments, it makes it more obvious (and where there are many optional parameters, may save some typing!).

With regards to the array_column function, PHP has a history of providing such functions for common operations, even where the same functionality can be replicated with more generic code constructs. For me, the function example you provide is more readable than the comprehension example, requires less typing and provides less room for mistakes. I.E. its simpler in this case, and that’s part of the way PHP rolls. There is of course an argument that functions like this should be provided by external libraries or frameworks rather than in the core of the language, but that debate has been had many times and PHP has come down on the side of including them. This is one of the reasons developers like me like PHP. YMMV.

Re: What PHP 5.5 might look like

#19
The "parameter skipping" functionality is really useful but IMO they should take the same route that C# did with named parameters.

    function create_query($where, $order_by, $join_type='', $execute = false, $report_errors = true) { ... }

    create_query("deleted=0", "name", report_errors: true);
can even specify all parameters by name in different order

    create_query(order_by: "name", report_errors: true, where: "deleted=0");

Re: What PHP 5.5 might look like

#20

No matter how much PHP is improved upon, until there is a serious contender framework for it like Rails or Django, PHP will continue its route to extinction. Dinosaurs were once big and powerful. They dominated the landscape. They don't exist anymore.

Thanks for coming in and expressing your dislike of PHP. You offer something we surely haven't heard a thousand million times before from other random trolls. Which languages make you cool by mentioning them in passing? Python ans Ruby? Awesome. Didn't know that. Thank you so much for your insightful critique of PHP.

"It's old so that makes it bad. Also, some real vague reference to the quality of the language and the current trendy frameworks". That's what I heard when I read that.

There is nothing new to say about PHP in this area. Every criticism has been played out and overused here a thousand times over. Thanks for the well formed, specific and detailed opinion that's completely irrelevant in the context of the article.

Post reply on HN