Re: Object Type Casting Reloaded

From: Date: Tue, 23 Apr 2019 13:51:12 +0000
Subject: Re: Object Type Casting Reloaded
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to internals+get-105358@lists.php.net to get a copy of this message
@Mark Randall <markyr@gmail.com> > It keeps coming back to the feature we've all been praying to the PHP > Gods for... generics. > $x = cast<App.Object>($obj); I did not think about using generics for this, but indeed this could work. It's only reasonably verbose, easily implemented in userland, and should be usable both by static analysis tooling, and potentially by the VM and JIT for future optimizations. It just costs an extra function call vs. a single opcode, but overall I could be OK with this approach. I'm not sure why generics haven't yet gained traction though, so unless there's a hope to see them implemented soon, I'll keep focusing on this standalone feature for now! - Ben

« previous php.internals (#105358) next »