Hans Moog wrote:
You are missing something. Using this new feature would be
voluntarily (it is optional like type hints are already).

Thanks for bringing that up right after I told you that I won't accept this argument ;-)

If you want to code the old way and you don't want to force coders to
use your functions correctly, you could leave out typehints an check
the parameters manually.

We don't check the parameters. Automatic type conversion does the right thing for us in 99% of the case and the other 1% is handled manually. Not checked, handled. Please note the difference.

You do not use type hints in your functions, thats why you don't
understand the need of overloding methods by parameter siganture. If
you would understand the need of type hints for robust applications
you would understand the need of overloading typehinted methods.

I disagree here:
1. Type hints are not needed for robust applications. That's a myth. They don't even make it easier IMHO. 2. Overloading is not necessary, you can use different names if you want different flavours of a method. That's clearer and easier to debug (I can search in the source code for a function name but not for a parameter signature).

Btw: You could call foo((integer) $x); to ensure the right method is
called.

That's *exactly* what I want to avoid. Your code ends up being messy for no good reason: Solving a problem you created yourself.

Like I already said, this feature is only require for people writing
complex web applications, offering api's to 3rdparty coders that are
very strict. If you are coding a project within your company you can
rely on the fact, that programmers should know how to use your
methods, but a 3rdparty coder who extends the functionality of your
product doesn't know and there should be no chance to crash the
application.

I don't think we would agree on what's a complex web application here (complex being a negative term for me, I'd rather write a simple but advanced web application) but even then the API should be simple. And simple APIs don't need whips and chains.

And I don't believe in fool proof APIs, only fools can use those ;-)

- Chris

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

Reply via email to