Hi,

On Sun, 2008-01-06 at 21:24 +0100, Marcus Boerger wrote:
> That said I would only agree to type hints if we make them respect existing
> PHP conversion rules.

Which we can't really do. Think about Mikko's example:

$b = '5';

function foo( int &$a )
{
  echo gettype( $a );
}

foo( $b );
echo gettype( $b );

Casting there would, for sure, create problems. Doing no cast fails when
thinking about Kore's example:

$ php -r 'var_dump( ~"1", ~1 );'
string(1) "�"
int(-2)

Or:
$ php -r 'var_dump( "1" ^ "2", 1 ^ 2 );'
string(1) ""
int(3)


I can see why people want it, but it won't really fit into PHP's type
system imo.

And about the part being "optional": As long as you only use your own
code it's optional, sure. But as soon as you use a library or maintain
code written by others it isn't optional anymore - while that of course
is true for all design decisions made by the previous devs.

johannes

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

Reply via email to