Live data from Hacker News

What PHP 5.5 might look like

nikic.github.com

111–120 of 139 posts

Re: What PHP 5.5 might look like

#111
post #68

I was involved with PHP internals when type hinting came up for 5.3, and helped steer that discussion in some way [1]. It was a truly awful experience - at the time, the internals community was a very negative and poisonousness place. Does anyone still involved know if that has been fixed? [1] oh look, I'm still mentioned in the RFC :) - https://wiki.php.net/rfc/scalar_type_hinting_with_cast

Given that you're involved in this - why add "with cast"? I thought the whole point of the feature, in regards to classes and arrays, is to be absolutely strict about function arguments. Once you start down the path of "well, as long as it's sort of like that," then you might as well accept objects that have toString defined in place of strings. Having worked in a large PHP project for years and trying to get it to a…

So I'm not involved in the current discussion, but I remember some stuff from the last discussion and in general.

To start, you can consider the problem of type checking of scalars in a language with implicit type coercions. You're supposed to be able to treat 0 and 0.0 the same. At the same time, if you have a type check that says "int", you kinda expect to get an int. So "with cast" does that.

I know a lot of people find that ugly, and that you want to strictly that you must receive an int, but that's just not how people use PHP, and it doesn't make sense in the context of the language. As an example, you want to be able to add type checks to all the functions in the standard library, many of whom treat null, "0", 0 and 0.0 to be the same.

For PHP specifically, there is the additional consideration that PHP is supposed to be a newbie friendly language. There was a perception in the PHP internals community that newbie developers could not wrap their head around the concept of "types". I've heard people say that a developer shouldn't be required to think about what types his variable might hold. Clearly this is lunacy for many reasons, but there it is.

Re: What PHP 5.5 might look like

#112

Earlier quoted context omitted.

Given that you're involved in this - why add "with cast"? I thought the whole point of the feature, in regards to classes and arrays, is to be absolutely strict about function arguments. Once you start down the path of "well, as long as it's sort of like that," then you might as well accept objects that have toString defined in place of strings. Having worked in a large PHP project for years and trying to get it to a…

So I'm not involved in the current discussion, but I remember some stuff from the last discussion and in general. To start, you can consider the problem of type checking of scalars in a language with implicit type coercions. You're supposed to be able to treat 0 and 0.0 the same. At the same time, if you have a type check that says "int", you kinda expect to get an int. So "with cast" does that. I know a lot of peopl…

I just read the RFC, and I think it's very good. The only minor quibbles I have would be using the "compiler" instead of the parser to produce the hint, and whether or not you should cast if losing precision. But these are minor issues that should probably be ignored, since this improves the status quo considerably.

Re: What PHP 5.5 might look like

#113
post #107
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…

array_column looks like a half-assed version of map. Looks like PHP hasn't changed a bit. Functions that do half of what their supposed to do and have odd names that depart wildly from industry standard language.

> have odd names that depart wildly from industry standard language

Err... what? You want map, use map.

http://us3.php.net/manual/en/function.array-map.php

Re: What PHP 5.5 might look like

#114
post #51

[deleted]

If you are fine running a decade+ old OS, chances are you don't have a dire need to run a bleeding edge version of PHP locally.

I don't know what you're responding to, but viewing your comment in isolation, I disagree. I work for a large hospital that has standardized on XP as the OS for desktop machines, and most of our server VMs are running Windows Server 2003. (Can't comment on what OS is hosting the VMs.) I don't have the freedom to upgrade my PC or the servers I deploy my code on, but that doesn't mean I should be stuck with an old version of PHP.

No, I don't have a dire need. But almost no one has a dire need.

Re: What PHP 5.5 might look like

#115
post #67
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 can't say I like the solution for parameter skipping though... I disagree with the author -- many optional arguments is not a problem IMO This is a problem and bad design, because instead of default arguments you can use properties for optional arguments.

You can, but: some function already exist with existing APIs - especially in libraries and existing internal PHP functions - and currently there's no way to say "I want default for the second parameter, but non-default for the third", unless you copy-paste the default from the docs.

Re: What PHP 5.5 might look like

#116
post #68

I was involved with PHP internals when type hinting came up for 5.3, and helped steer that discussion in some way [1]. It was a truly awful experience - at the time, the internals community was a very negative and poisonousness place. Does anyone still involved know if that has been fixed? [1] oh look, I'm still mentioned in the RFC :) - https://wiki.php.net/rfc/scalar_type_hinting_with_cast

Could you elaborate how this poisonousness was manifesting itself? It would be interesting to know what exactly you think needed fixing. I know some people on the internals can be a bit abrasive from time to time, but nothing different from what happens on other technical lists (actually, far less rudeness that I've encountered in many other places). However, your experience seems to be significantly different, could you elaborate on that?

Re: What PHP 5.5 might look like

#117

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.

Dinosaurs dominated the ecosystem for 135 millions of years out of last 200, and it took a major extinction event - most probably of extra-terrestial origin - which wiped about half of the existing species off the face of the planet to do them away.

I think you meant the comparison as insulting, but it actually isn't. You're saying PHP is a T-Rex of web development. It's a nice compliment :)

Re: What PHP 5.5 might look like

#118
post #116
post #68

I was involved with PHP internals when type hinting came up for 5.3, and helped steer that discussion in some way [1]. It was a truly awful experience - at the time, the internals community was a very negative and poisonousness place. Does anyone still involved know if that has been fixed? [1] oh look, I'm still mentioned in the RFC :) - https://wiki.php.net/rfc/scalar_type_hinting_with_cast

Could you elaborate how this poisonousness was manifesting itself? It would be interesting to know what exactly you think needed fixing. I know some people on the internals can be a bit abrasive from time to time, but nothing different from what happens on other technical lists (actually, far less rudeness that I've encountered in many other places). However, your experience seems to be significantly different, could…

It's been a few years (2008-2009ish), so my memory has faded a little bit. I recall a lot of discussions where no-one would listen to other people (if I recall, the scalar type checking thread from PHP 5.3 was a good example). A lot of hostility to people trying to change or improve things. Quite a lot of hostility towards users or people who complained about PHP (check out the bug tracker - very aggressive). Oh, and a complete disregard for other members of the community by the people in charge-ish.

Re: What PHP 5.5 might look like

#120
post #116

Earlier quoted context omitted.

Could you elaborate how this poisonousness was manifesting itself? It would be interesting to know what exactly you think needed fixing. I know some people on the internals can be a bit abrasive from time to time, but nothing different from what happens on other technical lists (actually, far less rudeness that I've encountered in many other places). However, your experience seems to be significantly different, could…

It's been a few years (2008-2009ish), so my memory has faded a little bit. I recall a lot of discussions where no-one would listen to other people (if I recall, the scalar type checking thread from PHP 5.3 was a good example). A lot of hostility to people trying to change or improve things. Quite a lot of hostility towards users or people who complained about PHP (check out the bug tracker - very aggressive). Oh, and…

I know that there are a lot of discussions - sometimes very long and tiresome - but what you mean by "no one would listen to other people"? I.e. what would happened if things went differently and somebody would listen, say in the thread about 5.3 scalar type checking?

I regularly check the bug tracker and I haven't noticed any special aggressiveness - of course, some of the volunteers may sometime be impatient, especially with newbies, or trolls, some of which lately for some reason decided it is appropriate to publish their "php sucks" diatribes on the bugtracker - but I didn't notice any systematic aggressiveness. Some data would be helpful here - demonstrating the problem may be necessary for fixing it.

Same for regard for other members of the community. Various members of the community regularly participate in the discussions, and once PHP moved to git they also submit pulls, rfc, etc. Yet still you describe the situation as "complete disregard" - so what you would say should be happening instead?

Post reply on HN