Fwd: [PHP-DEV] Type hinting - Request for Discussion

From: Date: Fri, 10 Jul 2009 16:10:33 +0000
Subject: Fwd: [PHP-DEV] Type hinting - Request for Discussion
References: 1 2 3 4 5 6 7 8 9 10  Groups: php.internals 
Request: Send a blank email to internals+get-44926@lists.php.net to get a copy of this message
---------- Forwarded message ---------- From: troels knak-nielsen <troelskn@gmail.com> Date: Fri, Jul 10, 2009 at 2:12 PM Subject: Re: [PHP-DEV] Type hinting - Request for Discussion To: Lukas Kahwe Smith <mls@pooteeweet.org> On Fri, Jul 10, 2009 at 1:40 PM, Lukas Kahwe Smith<mls@pooteeweet.org> wrote: > right .. lets not forget the original goal (though it hasnt been perfectly > defined) Good point, clarifying the goal should probably have been done long time ago. I think that some of the reason why this discussion has fragmented and begun to go sour, is that it started with an implementation proposal - not with a problem to be solved. This makes it very hard to agree on anything or even to have a meaningful discussion. So you suggest the following goals: Move common validation code out of the function body in order to * reduce code * increase readability * enable IDE's to be even smarter. That sounds like a good proposal. Now, static typing is one possible solution to that. Contracts is another. I like contracts better, since they focus on the interface rather than on the implementation. I think this is much more in lieu with php's type system. I do agree that moving imperative code into the signature complicates matters and looks rather messy. I don't think that's the case as per my initial proposal however. Now, static typing does provide one benefit over a strictly run-time contract. It enables a more meaningful static analysis of the code. This translates into smarter IDE's and enables certain transformations of source code (Eg. automated refactoring). But they also come at a cost in flexibility, makes the language more verbose and even then, it will still only be a partial solution. Personally I just don't think this price is worth it, just to get smarter IDE's. -- troels

« previous php.internals (#44926) next »