On Fri, 2008-01-04 at 10:06 +0200, Tomi Kaistila wrote: > > It really doesn't fit in very well with PHP's loosely typed nature which > > is one of the main reasons it has been so easy to use. > I think this is one of the cornerstones that two sides disagree the most on. > People are afraid that PHP would turn into a strong-typed language by > allowing type hinting for scalar values. I do not think this would be the > case. You would still have all the freedom that you have no with PHP, since > PHP's type juggling is still in effect. > > The only thing that would change is that the validation of the data that is > passed into functions would be somewhat automated, but since the validation > occurs with or without type hinting the result is still the same. If data is > incorrent, an error occurs whether it is an exception, a false return type, > or a triggered error. The behaviour of the program does not change with type > hinting.
Exactly. This is not strict typing. It's type hinting (key word, hinting). > > Even this thread shows that there's no alignment between people on what > > it should actually do. > This is true, but contributed to it is that so far we have spent more time > and > energy on the silly debate whether or not type hinting is a useful feature. > There is enough technical proof to suggest that it is in fact a useful > feature. > > What I would like to see is actual discussion on how it should behave and see > if a concensus can be derived. > > > Saying that it won't confuse newbies is also wrong. PHP is so popular > > because it's so easy for people to pick up. Part of this also includes > > ability to look at other people's code, understand it, copy-on-write > > (e.g. a Wordpress plug-in). > This is an argument that I honestly do not understand. Type hinting is > already > here. It exists in PHP. How can the concept be abandoned on the bases that it > would confuse new users, if the concept has already been approved and > implemented? > Exactly, array and class type hints are actually more confusing than scalar type hints. What's more confusing to a beginner, having to pass an instance of a certain object to a function, or having to pass a number or string? > > Tomi Kaistila > PHP Developer > -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php