Hi!

This is maybe getting a bit out of topic now, but what about function/method overloading using type hinting:

function myfunc(string $data) { }
function myfunc(int $data) { }
function myfunc(myClass $data) { }

This currently causes an error in PHP 5.2.5 that function myfunc() can't be redeclared. This would in my opinion be very useful for methods in classes.

Greetings,
Krister Karlström, Helsinki, Finland

Arvids Godjuks wrote:

I think type hint's would be good optional functionality. Those who need
will use it, others will not. I'd probably use it in some cases. Especially
if named parameters are implemented.

Sometimes what I really want is named parameter pass like

function myfunc(array $array, string $string = null, int $someint = 0){
}

myfunc($myArray, someint = $mySomeInt);


--
* Ing. Krister Karlström, Zend Certified Engineer         *
* Systemutvecklare, IT-Centralen                          *
* Arcada - Nylands Svenska Yrkeshögskola                  *
* Jan-Magnus Janssons plats 1, 00550 Helsingfors, Finland *
* Tel: +358(20)7699699  GSM: +358(50)5328390              *
* E-mail: [EMAIL PROTECTED]                       *

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

Reply via email to