Re: Type hinting - Request for Discussion

From: Date: Fri, 10 Jul 2009 11:40:47 +0000
Subject: Re: Type hinting - Request for Discussion
References: 1 2 3 4 5 6 7 8 9 10 11  Groups: php.internals 
Request: Send a blank email to internals+get-44901@lists.php.net to get a copy of this message
On 10.07.2009, at 13:20, Lewis Wright wrote:
3)      function Foo(is_int($x)) {
Function is_int is called, an error is raised if it returns false.
But then you're complicating it to the point where it's no longer much more useful than just calling the is_numeric method in the function body. Plus there's no longer the advantage of optimisers knowing the data-type.
right .. lets not forget the original goal (though it hasnt been perfectly defined) the idea was to move common validation code out of the function body to reduce code, increase readability and enable IDE's to be even smarter. moving the function body into the signature was not the plan, as it will kill the above features for the sake of flexibility. the point is not flexibility, its finding a sensible common denominator for validation of input parameters and optimizing the syntax for that case. regards, Lukas Kahwe Smith mls@pooteeweet.org

« previous php.internals (#44901) next »