Re: RE: Optional scalar type hinting

From: Date: Thu, 03 Jan 2008 20:35:31 +0000
Subject: Re: RE: Optional scalar type hinting
References: 1 2 3 4 5 6 7  Groups: php.internals 
Request: Send a blank email to internals+get-34347@lists.php.net to get a copy of this message
On Thu, 2008-01-03 at 12:27 -0800, Stanislav Malyshev wrote: > > patches out there, it doesn't slow down the general case. So why > should > > we *not* add it? (And yes, I changed my mind) > > My opinion is that the language is not a salad of features that somebody > somewhere found useful. The language should have some directions and > properties that make it easy to understand and handy to work with. > Having both strict and non-strict typing in the same language does not > seem like a good idea to me. In a way this is true, but I look at it this way. Some languages are strictly typed, some are dynamically typed. PHP can have the best of both worlds by having optional strict typing where desired, as well as dynamic typing. I have numerous cases where I will have a type hinted parameter and a non type hinted parameter in the same function. This way we can have maximum flexibility where useful, but also control where needed. Keep in mind, this is not "strict typing" in its correct definition. Strict typing allows very little room for type conversion. This is optionally hinting the desired type of a function parameter.

« previous php.internals (#34347) next »