On Wed, Jun 22, 2016 at 11:59 AM, Lester Caine <les...@lsces.co.uk> wrote:
>
> If all these other languages are so much better why is the usage of PHP
> *SO* much greater than any of them with no sign of any of them gaining
> traction?

I'm sorry, but that kind of rhetoric is really unproductive.

At no point did anyone suggest that type-checked properties was the
*only* difference between languages that matter - that would be
absurd.

All anyone is suggesting, is that it *does* matter - to argue that it
doesn't, solely based on what people are choosing, is silly. There are
many factors of choice.

I (along with most of my co-workers) yearn for a language-level
replacement for the ugly, unsafe, verbose php-doc tags everyone needs
to scatter around right now to get proper inspections about
property-types etc. - that yearning isn't driving me to another
language, because there are many other aspects to the language that I
enjoy, but it does remain on my top-10 list of the most desperately
missing features in PHP.

Having worked in other gradually-typed languages like Dart and
Typescript, PHP feels crippled on this point - it's gradually-typed,
but inconsistently so, and inconsistency is the worst kind of evil you
can have in any programming language.

New PHP developer:

- great, I can declare types like classes and interfaces!
- great, I can type-hint parameters!
- great, I can type-hint return-types!
- oh wait, how do I type-hint my properties...?
- oh. I can't.
- oh, there's tools for that.
- oh, tools only do half the job...

The learning curve for new users isn't increased by the introduction
of property type-hints, it's *decreased* - they have to learn about
types to write classes and interfaces, they have to learn about
type-hints when it comes to functions, but then, in addition, they
have to learn about the things they *can't* type-hint, for some
reason, not that anybody is offering an explanation, it's just a
matter of fact, and then in addition they need to go and learn about
php-doc and offline inspection tools and IDEs and so forth.

And a lot of developers are going to give up and resign themselves to
doing just what the language offers, long before learning all of that,
which could take them years, and in the mean time they write and
publish "newbie-looking" code, giving PHP developers a bad rep, lower
salaries, etc. - but it's not their fault, as most of them have a boss
asking them to produce code, now, and learning how to work around the
language to write good code takes a long time and a lot of effort for
most people. Meanwhile, skilled developers who went the extra mile are
out there complaining about these missing features in PHP.

Give them a consistent language and new developers will rise to the
occasion - I'm sure of it. You're just not giving them a chance.
Type-hinted properties are a step towards fixing that situation - they
don't add, they *remove* complexity and learning curve from the
language.

Consistency, when it comes to languages, is always simpler and less
surprising than inconsistency.

PHP *has* type-checks - the introduction of property type-hints is not
a new feature, it's fixing an inconsistency.

Sorry, for the rant, but anti-type-hints is just anti-consistency. We
have type-hints, now let's please take another step towards finishing
the job!

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to