Live data from Hacker News

What PHP 5.5 might look like

nikic.github.com

131–139 of 139 posts

Re: What PHP 5.5 might look like

#131
post #72

Conspicuously absent from PHP: array_copy() ... in order to copy-by-value on arrays containing references. Currently to do that you have to do a very fragile hack like this: $copy = array_flip(array_flip($original)); ... which is vulnerable to key-value collisions ... or you have to write your own homebrew array copy-by-value function.

File a bug report :)

Better yet, file an RFC and a pull request.

Re: What PHP 5.5 might look like

#132
post #127

Earlier quoted context omitted.

There indeed was no consensus on the topic of strict typing and on some other topics - but it's only natural, people have different opinions and sometimes there's just no agreement between them. Especially if you are advocating wide regard for all people in the community, you have to accept that sometimes there would be no way to reach a decision that is agreeable to everyone. In the strict typing case that is what h…

My point is not that there should be consensus. My point is how the discussion went (and many similar discussions, not just one). Poison comes from how community members treat each other, not whether or not they can agree on something. I've spent major time in 3 open source projects, gcc, Mozilla and PHP. All of them suffered from similar disagreement, from old code, from old decisions they need to move away from. Th…

Unfortunately, I'm still not sure what you mean by "poisonous". To me it sounds like "community is poisonous because discussions are held wrong, and the discussions are wrong because community is poisonous". Maybe it's just me but I have hard time understanding what exactly is the problem here except for the fact that you obviously dislike something about PHP community. But if somebody asked me what exactly you dislike and what you'd have fixed if you could - I couldn't really give any meaningful answer.

Re: What PHP 5.5 might look like

#133
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 do not believe you can improve generic list comprehension/generator system to a level it would have the speed of a specialized C function, unless you make a special case in the compiler which would effectively call such function instead of actually generating the code as written.

Re: What PHP 5.5 might look like

#134
post #132

Earlier quoted context omitted.

My point is not that there should be consensus. My point is how the discussion went (and many similar discussions, not just one). Poison comes from how community members treat each other, not whether or not they can agree on something. I've spent major time in 3 open source projects, gcc, Mozilla and PHP. All of them suffered from similar disagreement, from old code, from old decisions they need to move away from. Th…

Unfortunately, I'm still not sure what you mean by "poisonous". To me it sounds like "community is poisonous because discussions are held wrong, and the discussions are wrong because community is poisonous". Maybe it's just me but I have hard time understanding what exactly is the problem here except for the fact that you obviously dislike something about PHP community. But if somebody asked me what exactly you disli…

To be honest, I think you are trying really hard to pretend my points aren't made rather than trying to use my points to investigate the phenomenon. I'll admit I'm not explaining them terribly well - its been 4 years since I've taken active part - but there's enough information in there that you could use it as a starting point if you were truly interested, which I think you aren't.

Re: What PHP 5.5 might look like

#136

Earlier quoted context omitted.

Having taken over a project that uses CI at it's core, I've found a number of things that definitely put it in a league below frameworks that were built with PHP 5.3 in mind. * Way too much magic - everything (libraries, models, etc.) is globbed onto a superglobal class, which breaks auto-complete in IDEs and in general makes debugging harder * No proper autoloader (PSR-0 style) - the built in autoloader can't autolo…

Okay, so a bunch of personal preferences that don't actually matter in the real world? Thanks for your insight, but it does not make CodeIgniter bad. > frameworks that were built with PHP 5.3 in mind. Well no crap, CodeIgniter is built for newbies in mind, people who don't have up to date PHP installs because their shared hosting doesn't keep it THAT up to date. The newest versions of CodeIgniter are VERY good, and j…

Those aren't (all) personal preferences. Using superglobals is definitively bad, in the same way that using GOTO is. Not using PSR-0 autoloading is flying in the face of the community consensus and makes it much harder to use other libraries with CI compared to other frameworks.

Your point about PHP versions isn't very valid. 5.3 is over 3 years old now! Plenty of cheap hosts are far more up to date than that.

There is a difference between being "newbie friendly" (which I will admit, CI is - it's a lot easier to get into than say, Zend, by orders of magnitude) and "enabling bad practices". You could say that using mysqli and concatenating data into your queries is newbie friendly, and it is - it's a lot simpler conceptually than prepared statements, but that doesn't stop it being categorically a bad idea.

For the record my CI experience ended about 9 months ago, and I have contributed code to CI, so I feel that when I say certain parts of the internals are very badly coded I do have some valid perspective on that issue.

Re: What PHP 5.5 might look like

#137
post #72

Conspicuously absent from PHP: array_copy() ... in order to copy-by-value on arrays containing references. Currently to do that you have to do a very fragile hack like this: $copy = array_flip(array_flip($original)); ... which is vulnerable to key-value collisions ... or you have to write your own homebrew array copy-by-value function.

Very simple.

Either:

    $copy = $original;
Or, if you must have a function,

    function array_copy(array $a) {
        return $a;
    }
Arrays use the normal copy-on-write semantics of PHP. They are not passed by reference or object handle...

The only potential issue is if the array contains references deeper in.

Re: What PHP 5.5 might look like

#138
post #132

Earlier quoted context omitted.

Unfortunately, I'm still not sure what you mean by "poisonous". To me it sounds like "community is poisonous because discussions are held wrong, and the discussions are wrong because community is poisonous". Maybe it's just me but I have hard time understanding what exactly is the problem here except for the fact that you obviously dislike something about PHP community. But if somebody asked me what exactly you disli…

To be honest, I think you are trying really hard to pretend my points aren't made rather than trying to use my points to investigate the phenomenon. I'll admit I'm not explaining them terribly well - its been 4 years since I've taken active part - but there's enough information in there that you could use it as a starting point if you were truly interested, which I think you aren't.

Sorry, your assumption about my motives is wrong. I would be really interested in finding out what exactly people on internals did so you call PHP dev community "poisonous" on every available opportunity (this is not the first time I read this from you, though it is the first time I had a chance to try and find out why). Unfortunately, I was unable to understand what offended you so much. If you didn't guess it yet, I was present on the internals list at that time (and long before and after that) so I had the opportunity to personally observe all those tiresome and long discussions and many more. So I thought I have pretty good starting point and enough information to at least try to understand your complaints. However, I still failed to figure out why you think PHP dev community is "poisonous". I guess it's not to be, well, at least I tried.

Re: What PHP 5.5 might look like

#139
post #138

Earlier quoted context omitted.

To be honest, I think you are trying really hard to pretend my points aren't made rather than trying to use my points to investigate the phenomenon. I'll admit I'm not explaining them terribly well - its been 4 years since I've taken active part - but there's enough information in there that you could use it as a starting point if you were truly interested, which I think you aren't.

Sorry, your assumption about my motives is wrong. I would be really interested in finding out what exactly people on internals did so you call PHP dev community "poisonous" on every available opportunity (this is not the first time I read this from you, though it is the first time I had a chance to try and find out why). Unfortunately, I was unable to understand what offended you so much. If you didn't guess it yet,…

I didn't assume anything about your motives, but I didn't mean to be harsh. You do come across as an "apologist" for the community though. There are of course many communities that behave similiarly, but that doesn't make them healthy.

Look at it this way - imagine you had a conversation with a group of people 4 years ago, and they acted like dicks. Now, four years later someone challenges you to explain how they were dicks. It's really hard to give an answer better than "i dont know, they were just dicks alright" :(

Post reply on HN