2015-02-02 11:12 GMT+02:00 Dmitry Stogov <dmi...@zend.com>:

> hi,
>
> could you please write down few use cases, when strict scalar type hints
> are really useful.
>
> Thanks. Dmitry.
>

Hello Dmitry,

At the moment, being a user-land dev for a little bit more than 10 years, I
just don't see the usage for the strict type hints at the moment. I just
can't imagine it actually being usefull for the masses. Yes, some deep core
library code may use them, wrapped in layers and layers of code, so deep,
that it actually works.

But on a day to day basis? No-no-no-no-noooo. I'll probably mess it all up
quite fast and end up just stripping those away. It's quite a foreign
concept for me for the PHP code (not that I haven't written in strict typed
languages, but I had to define all the variables up front in the program).
On a day to day basis I juggle a lot data back and forth - parsing an XML
document comes to mind immedeatly (because I have tons of them, with all
kinds of data), i handle a lot of JSON data (including input, that is
mostly strings, because it comes from forms in text form), memcached is
other example. CVS files. And so on. It's the little everyday stuff that
after years just feels natural to do that will be affected and cause grief,
and these days many liek to jump on the hype train without any regard for
the others.

So, for me, the first step is to get the "converting", "Weak" or whatever
you call them, type hints into the language. And I have a perfect case of
"why" for it.
Just look back at how OOP arrived into PHP and how it evolved.
PHP 4 (yeah, I remember some from those days still) was very basic, and for
me that was a very short phase.
Them came PHP 5 with it's more serious OOP aproach and features. And in 10
years look what has become of the OOP feature set? And all of it really
fits. It started with the basics and ended-up in a very good state. And
most additions that came along had time to be understood and solidify
before more was added. People eased in into it naturally and many changed
their views on the subject with time.

So, I would recomend to start with a small step, see how it's gonna be used
and actually get feedback first. Because you can always go stricter if
needed, but removing such a major feature like "strict typehints" probably
gonna be messy as hell, if even possible if it does not work out. Get the
weak type hints in, wrote code, get a feeling for them, understand the
impact and then make an informed decision - do we actually need to go
stricter?

Thanks,
Arvids.

Reply via email to