On Thu, 2014-10-02 at 19:33 +0100, Dominic Grostate wrote: > My concept can be found here: > https://gist.github.com/orolyn/9ff0756b3cb3cdfe454b > > Advantages: > - Methods expecting strict values would no longer need to use inline type > checking for scalar types. > - Users could define reusable type checking for almost any type of value. > - Since the definitions would be user defined, there would be no chance of > conflicts with existing classes. > > Disadvantages: > - Assertions would have to be static and stateless if you are using a good > dependency injection pattern. > - Users of libraries incorporating custom type hints may become confused as > to what an argument should be if not properly documented. > - Complications with IDE intellisense (primarily with type detection). > > I left out performance issues in the disadvantages because I truthfully > don't know what they would be. > > The example I provided is simply a concept. If the theory is desirable, > then the design is completely reworkable.
This is missing basic information like relation to namespaces. By the dynamic nature of PHP this also most likely means that each use of this leads to anb additional function call for each parameter. Given the fact that function calls are one of the slowest parts in the engine this is a *massive* cost. I also foresee "clever" developers doing "clever" magic inside those type cheking routines and in the end creating an undebugabble mess. johannes -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php