Kris Craig

I usually just read the list, sometimes add if I have something to say and
I had voiced my opinion on typehinting before. And you know, just from the
stand of a userland developer who has 7-8 years of experience and devoting
myself to the excelence at PHP, i see this discussion about adding strict
typehinting to PHP as ridicilous. I cannot express my thrustration, because
i would probably be kicked out of the list permanently.
The problem is that those, who are actually advocating for this, come from
all sorts of languages (or have moved to them some time ago) and now what
to "make php better". Sorry folks, but I have picked up a script language
not because it has strict type hinting, but actually because it does not
have it. And because in web we are working with text. Almost any data we
get is text and in critical places we just check that data we have is
actually a number and not a random string. Or is an object of certain type.
Or is an array. Or a valid string. And we let the PHP to handle routine
conversions. And it's good because there can be tons of them per single
script call. String to number and vice-verse conversions are all over the
place in almost any script. They are so common, that if you would add
strict typehinting - you would probably need a type conversion on every
function/method call.

PHP had (and i have to believe it still has, but people started to really
forget it) a principle called KISS. And strict typehinting is NOT simple.
It really complicates things, a lot. And really, in a scripting language?!
Are people going nuts because of 2012? Has to be, because i just can't
explain what is happening with the typehinting rfc discussions for the last
year.
The way i see it, there is two types of people. The PHP crowd, that says
that optional weak type hinting could be helpfull and strict-type hinting
crowd witch has come to PHP from different languages or had moved from PHP
to them, but ocasionaly returns to it.

What i thing is that core devs should really look at what the php is, on
what principles it is built and based. Remember what it was built for and
why it's popular. And that if you handle it correctly - it's a powerful
tool, and works great. And that we do not need other python, perl or ruby.
PHP always had it's own way and it should. My vote is for optional weak
typehinting that will do what the most want - to write a more solid library
code with less annoing checks and does not put additional restraints on the
userland code. Because if you give people something like strict typing - it
just will get abused to such extreme by some people, that it will create
more negative than good in the long run.

PHP is not the easiest language out there. Yes, it's easy to start with,
but it's not that easy to master and strike the right balance between
simplicity and complexity. And people tend to go overcomplex forgetting the
KISS. I'd rather see the PDO getting a major kick, or dumped allready and
work gone into db drivers and unicode support improvement - these are far
more important than strict type hinting.

Reply via email to