On Thu, Feb 5, 2015 at 9:50 PM, Andrea Faulds <a...@ajf.me> wrote: > Hi, > > > On 5 Feb 2015, at 06:52, Dmitry Stogov <dmi...@zend.com> wrote: > > > > I completely agree. > > Strict typing doesn't fit into PHP. It was already told thousand times. > > Seems to work rather well in practice, so long as it’s optional. >
"works" and "fits" are different. > > Also, the only really useful case for "strict typing" is the ability to > catch mistakes in user apps. > > However, this ability is really limited. Implementing "Design by > Contact" approach may be much smarter. > > It’s not that limited. I caught two different bugs in my app simply by > adding strict types. > > Strict typing, crucially, allows the catching of errors ahead of time, > too. You can’t do that with weak typing, because it depends on the value, > not the type. And you don’t know the value from reading the source code. > Strict type hinting may help catching problems only at run-time. In PHP you almost never can do something ahead of time, because of run-time binding. You may only guess, analyzing the whole projects and performing type inference. Thanks. Dmitry. > > -- > Andrea Faulds > http://ajf.me/ > > > > >