On Thu, Apr 28, 2011 at 10:05:01PM -0700, Stas Malyshev wrote:
> Hi!
> 
> >I will accept that sometimes it must always be done run time, eg:
> >
> >     $funcName($arg)
> >
> >but that still allows most calls at compile time.
> 
> This is not the issue. This is the issue: $foo->bar($arg).
> There's no way to resolve it in "compile time", whatever that means, 
> without having a type on $foo.

Which a good compiler with time to burn (think HipHop not Zend) could do, eg:

        function joe(SomeClass $foo)

or:

        $foo = new SomeClass();

or:

        function SomeClass fred() { ... }
        ...
        $foo = fred();

> >Anyway - the check for return type would be done in the called function,
> >not the calling function.
> 
> That's the point. You don't get any extra safety on the caller's side, 
> because you don't actually know much about the called function. With 

You could by resolving the 'requires' at compile time, most of which you
can. Yes you can find some examples when it won't, but don't ignore
the most for the sake of a few.

> You are talking about pretty big change in language nature - introducing 
> strict typing. "It's just option, don't use it if you don't want" 
> doesn't really sound good in this case. If it's in the language, it 
> should make sense and sit well with the rest of the language.

And it will.
Objects are a big thing in the language - but their use is not mandated,
many programs don't use them.

-- 
Alain Williams
Linux/GNU Consultant - Mail systems, Web sites, Networking, Programmer, IT 
Lecturer.
+44 (0) 787 668 0256  http://www.phcomp.co.uk/
Parliament Hill Computers Ltd. Registration Information: 
http://www.phcomp.co.uk/contact.php
#include <std_disclaimer.h>

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

Reply via email to