---------- Forwarded message ----------
From: troels knak-nielsen <troel...@gmail.com>
Date: Fri, Jul 10, 2009 at 2:12 PM
Subject: Re: [PHP-DEV] Type hinting - Request for Discussion
To: Lukas Kahwe Smith <m...@pooteeweet.org>


On Fri, Jul 10, 2009 at 1:40 PM, Lukas Kahwe Smith<m...@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

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to