Am 27.04.2008 um 00:24 schrieb Nathan Nobbe:
On Sat, Apr 26, 2008 at 2:06 PM, David Zülke <[EMAIL PROTECTED]>
wrote:
Wouldn't the most consistent way be to omit "function" altogether
when
using a return type hint?
public static function zomg() {
return $somethingArbitrary;
}
public static string foo() {
return $mustBeString;
}
i think leaving 'function' in there makes sense because thats the
way php
currently works.
Well that was my point. Functions without return type hints use
"function", to indicate that they are generic in this respect, and
functions/methods with a type hint omit it to signal the difference.
Having both would be redundant. But then...:
otoh, should there ever be a type "function" (e.g. for anonymous
funcs) down
the road, that'd mean trouble ;)
wow; good point! maybe if anonymous functions are ever supported
the type
could be capitalized as in 'Function'
public function Function doStuff() {
return function() {}
}
Absolutely not. Right now, all PHP native types are lowercase. Can't
see why anon functions should be different.
Actually, both ways have problems:
public function gimmeThat() {
return function() { echo 'yay'; }
}
is ambiguous if return type hints require omitting "function", and
public function function gimmeThat() {
...
}
is just plain ugly.
So maybe anon funcs should have a different type name :p
David
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php