Hello Jason,

Monday, May 10, 2004, 5:31:38 PM, you wrote:

> Hello,

> I've been following this discussion from the beginning.  To be pointed, I 
> think that the whole matter is rather a serious case of "overfunctionality".

> Consider allowing a type hint such as
> function foo(MyClass $bar)

> The only way I see that as being useful is to be able to assume that you 
> can safely say   $bar->DoSomething()    from within your function WITHOUT 
> FIRST HAVING TO write an if() statement that verifies that it is not null.

> Even allowing null as a default parameter is somewhat disturbing.  The 
> programmer should ditch the typehint if he needs any behavior other than 
> the one described above, and use a simple if() statement to find out if it
> is the correct class.

Until here i very much agree. To clearify: The reason i provided all the
patches is that i simply want the descibed behavior as default and if at all
a syntax addition to allow NULL explicitly.

> If it is deemed necessary to allow a NULL default parameter, then let's 
> keep it simple - function foo(MyClass $bar = NULL)

As i pointed out before this solution comes with a slight disadvantage and
it also contains some magic. It is simply semantically very different from
secifying the allowed types and setting a default value. Combining them is
therefore magic that is hard to understand.

> IMHO, PHP has always been a language that can be used very simply, but 
> still has the low-level power to accommodate all the other things that one
> wishes to accomplish.  Let's keep it that way.

Yes we have very good solution which one must not use. In C++ or Java you
are forced to use all the syntax or you will fail.

best regards
marcus

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

Reply via email to