I'd like to also ask people to read what the intended effect of the proposal is instead of going into abstract discussions about how casting one class to another doesn't make sense (this is not what's being proposed).

Just like PHP typehints look like static typing but *aren't*, the same way the fact this looks like a static cast *doesn't* make it so. A dynamic language can't have static casts, and I'd think this is obvious to everybody.

Instead, I'm adapting the principle so it fits with existing PHP behaviors and patterns.

Syntax which looks like static typing is fine by me as well. Examples:

ClassName $foo = expression();

foreach ($list as InterfaceName $item) { ... }

etc.

The only operation done here is validating the variable is a valid instance of this type. No transformation is happening.

Stan

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

Reply via email to