This is really making what used to be an easy to read, easy to learn language a lot less of that. Some of us still don’t use IDEs and are okay with more thoroughly defined code that is readable. If people are so gung ho on adding in syntax hacks, shortcuts, etc, they seem to be bringing ideas from other languages and why not simply continue to use that other language? PHP seems to be looking more and more like Go or…
What's New in PHP 8.1
31–40 of 112 posts
Re: What's New in PHP 8.1
#32> array_is_list This is a stupid solution to a stupid problem. Defaulting to weak typing has enough problems, but changing the behavior of your data structure based on its contents is next-level pain. I used PHP for a few years at a student dev job and I can’t count how many times this conflation wasted my time and introduced various bugs. If PHP wants to become more respectable as a PL, it has got to break that out…
Re: What's New in PHP 8.1
#33"New array_is_list function" I use PHP a fair amount, but this is one area that irks me. PHP arrays can be arrays, lists, and hash maps. PHP obviously copied some of Perl's features, and I never understood why hashmaps and arrays weren't different types, as they are in Perl.
Thanks to their mixed nature they're very versatile. People even make small DSLs out of them. And they're order-preserving, so they won't inject non-determinism just to smugly teach you a lesson about real hash tables.
Re: What's New in PHP 8.1
#34I do not think PHP is a good language to use in a project. - dev recruitment is hard. - dev retention is hard. - hard to find people that write clean, modern, performant PHP - it is PHP, with everything that it entails. It does not enjoy the best reputation as a language.
Number of available developers is still high but it could be even higher if it had the same successful propaganda as JavaScript or Python.
There is nothing in the language itself that should stop it from competing with any general purpose language, not anymore.
I think this is the next important step for PHP, have charismatic & humorous evangelist like Douglas Crockford.
Crockford’s missionary work was done during a time when JavaScript was in a big expansion because everyone wanted to write single page applications.
But today there is huge JavaScript fatigue and more and more developers have start to realize that server side rendering is (back to) the future for most of the traditional web, especially in a time where time to market has become even more important.
The constant churn of the JavaScript realm have now reached epidemic levels, a massive & relentless wave of deprecated and unsupported projects sweeps over every organization. Somewhere right now some poor developer inherits a Angular 1.1 project built with gulp.
I think also there have been a shift in regards to fullstack developers versus frontend & backend developers, many companies have woken up to disastrous idea of splitting frontend & backend developers into separate teams and now merging them again, as result the fullstack developer becomes more important. PHP is in my opinion best fullstack web platform you can use.
Say after me, No more build steps for rendering a paragraph, no more unhandled Ajax errors, no more REST JSON apis with only the frontend as consumer, no more reimplementing the database schema in JavaScript, no more asynchronous state rendering on the same page.
Re: What's New in PHP 8.1
#35I do not think PHP is a good language to use in a project. - dev recruitment is hard. - dev retention is hard. - hard to find people that write clean, modern, performant PHP - it is PHP, with everything that it entails. It does not enjoy the best reputation as a language.
Dev recruitment is hard to find php developers? wtf are you smoking? I think a lot of this is highly dependent on where you are. My guess is you mostly deal with non php languages?
No way. It is pretty easy. To be fair it is harder in the Bay Area than let's say Europe, but it is still a non-issue. Also, the language is extremely easy to pick up, everyone is able to understand the code. This week for example I 've had an ios dev that is using Obj-C/Swift just dig into the code themselves to get clarity on an endpoint's execution.
> dev retention is hard.
Never really had an issue there.
> hard to find people that write clean, modern, performant PHP
This also has not been a problem in the past few years. For context, I 've had multiple devs excited and pushing to start using new PHP8 features, already (and I had to be the boring one and ask to wait for hotfixes, a version .1 or .2 and see how stable and secure 8.x is first).
> It does not enjoy the best reputation as a language.
This is true. I 've met people who refuse to even look at PHP code, even though they are paid to do so (they might even refuse at the detriment of their peers). I 've never seen a "this is beneath me" attitude with any other tool or language before. (except perhaps the hate SQL databases got in 2015-2016) So yeah, the hate runs deep.
Re: What's New in PHP 8.1
#36What is the idiomatic way to have data in an enum in PHP, aka sum types? Sum types in languages like Rust or Haskell or OCaml can have data associated with them. You'll get an error before runtime if you assume a field is available when it isn't.
Offline typecheckers (not included with PHP) can analyze the control flow to prove that any invalid types have been ruled out when an operation happens. It's not nearly as principled as proper sum types, but it works alright in practice.
PHP's upcoming enums are simple values, more like C's enums than Rust's enums.
[0]: https://www.php.net/manual/en/language.types.declarations.ph...
Re: What's New in PHP 8.1
#37This is really making what used to be an easy to read, easy to learn language a lot less of that. Some of us still don’t use IDEs and are okay with more thoroughly defined code that is readable. If people are so gung ho on adding in syntax hacks, shortcuts, etc, they seem to be bringing ideas from other languages and why not simply continue to use that other language? PHP seems to be looking more and more like Go or…
Are you saying you do not use IDEs? What is your rationale for that decision?
Re: What's New in PHP 8.1
#38> array_is_list This is a stupid solution to a stupid problem. Defaulting to weak typing has enough problems, but changing the behavior of your data structure based on its contents is next-level pain. I used PHP for a few years at a student dev job and I can’t count how many times this conflation wasted my time and introduced various bugs. If PHP wants to become more respectable as a PL, it has got to break that out…
Could you give examples of this? I'm of the opinion PHP could use more strictly typed arrays/lists, but I haven't run into any issues with PHP arrays myself.
Re: What's New in PHP 8.1
#39"New array_is_list function" I use PHP a fair amount, but this is one area that irks me. PHP arrays can be arrays, lists, and hash maps. PHP obviously copied some of Perl's features, and I never understood why hashmaps and arrays weren't different types, as they are in Perl.
Funny. I almost dislike all of PHP but think that their choice of basic data structure is the one good thing. Computers are getting faster and faster and simplifying programming could be done to a whole new level. Clojure for example has a similar approach. Okay, PHP lacks contracts, but maybe PHP adds them in 20 years when the mainstream understands that they are great.
It also makes some potential niceties impossible. Python can give a special meaning to a negative index into a list, because it can never truly exist, but PHP has to treat it like a key and do a normal lookup.
Re: What's New in PHP 8.1
#40This is really making what used to be an easy to read, easy to learn language a lot less of that. Some of us still don’t use IDEs and are okay with more thoroughly defined code that is readable. If people are so gung ho on adding in syntax hacks, shortcuts, etc, they seem to be bringing ideas from other languages and why not simply continue to use that other language? PHP seems to be looking more and more like Go or…
No one is forced to use the new syntax, it's just different tools in the tool belt.