> On Jul 12, 2021, at 1:56 PM, Max Semenik <maxsem.w...@gmail.com> wrote:
> 
> On Mon, Jul 12, 2021 at 8:01 PM Mike Schinkel <m...@newclarity.net 
> <mailto:m...@newclarity.net>> wrote:
> Additionally in Go a type assertion can return a second value which is 
> boolean telling if the type assertion succeeded.  Not having this would 
> effectively moot the benefit to a type assertion if you had to wrap with 
> try{}catch{} in case it failed.
> 
> Not necessarily:
> 
> if ($obj instanceof MyClass) {
>     // We know its type here
> } else {
>    // Try something else
> }

Well there you go.  

It seems you have just illustrated why in reality we really do not need type 
casting/assertions in PHP given its current features, because we already have 
what we need.

-Mike

Reply via email to