Hello Johannes,

  then obviously pass by reference and base type hints are not compatible.
Apart from that so far in PHP it does not matter whether a variable changes
in base type. And we should not change this nature of PHP.

marcus
  
Sunday, January 6, 2008, 10:03:44 PM, you wrote:

> 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




Best regards,
 Marcus

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

Reply via email to