5 ms·
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
by pbiggar 14y ago
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 https://wiki.php.net/rfc/scalar_type_hinting_with_cast
- swivelmaster 14y agoGiven 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 point of letting new developers spin up pretty quickly (and use PHPStorm efficiently), STRICT type hinting is one of the best tools possible!
- pbiggar 14y agoSo 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.
- pbiggar 14y agoI 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.
- smsm42 14y agoCould 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?
- pbiggar 14y agoIt'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.
- smsm42 14y agoI 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?
- pbiggar 14y agoWhen I say "no one would listen" I mean the long and tiresome discussions. I saw people just repeating themselves, without taking on board what other people were saying. I never saw these discussions end well. There was no consensus - the discussions eventually died out without any progress. I think there might be some Stockholm Syndrome there. The volunteers in the PHP bug tracker are dicks! Or were, it's been 3 years so things may have changed. And I'm not talking about responses to trolls, I mean to ordinary users. I mean they disregard the feelings of the other people in the community, not their code. I'm not really talking about how dysfunctional the coding practices were, I mean the actual community dynamics. It felt a lot like trolls feeding trolls.