> Just ... Isn't that something, we can simply keep out of _this_ RFC and > create separate RFC(s) for it later? Like it was done with "$this in > Closures"?
Do we want another 5.3/5.4 closures situation? Why not iron it all out to begin with? If there's a sound, logical reason not to implement the functionality in question, that's fine. I don't understand why we keep reiterating "keeping it simple" as if that is in itself an excuse to, in effect, rush it through half-baked. In the RFC, there are use cases citing languages like Java to support this - a language in which anonymous classes and the methods in which they're defined, share scope. Can we then say, let's do it because it's useful in other languages, but let's not offer the functionality that those languages do? Also, my proposed use case being practical in the real world hangs on resolving the scope issue, as I struggle to look past the difficulties I'd have trying to use this in my code when it's unable to interact with the object instance in which it is being used. That's all I'll say on that now; it's becoming circular. If you want to update my use case in the RFC, here's an expanded example of what I imagine. I've lifted code from the documentation for Sentry* and below it, written an alternative anonymous class API example. * I have no affiliation with Sentry / other membership packages are available. try { // Find the user using the user id $user = Sentry::findUserById(1); // Log the user in Sentry::login($user, false); } catch (Cartalyst\Sentry\Users\LoginRequiredException $e) { echo 'Login field is required.'; } catch (Cartalyst\Sentry\Users\UserNotActivatedException $e) { echo 'User not activated.'; } catch (Cartalyst\Sentry\Users\UserNotFoundException $e) { echo 'User not found.'; } // Following is only needed if throttle is enabled catch (Cartalyst\Sentry\Throttling\UserSuspendedException $e) { $time = $throttle->getSuspensionTime(); echo "User is suspended for [$time] minutes."; } catch (Cartalyst\Sentry\Throttling\UserBannedException $e) { echo 'User is banned.'; } becomes: $user = Sentry::findUserById( 1, (new class implements Cartalyst\Sentry\LoginHandlerInterface { public function onLoginRequired() { echo 'Login field is required.'; } public function onUserNotActivated() { echo 'User not activated.'; } public function onUserNotFound() { echo 'User not found.'; } // Following is only needed if throttle is enabled public function onUserSuspended() { $time = $throttle->getSuspensionTime(); echo "User is suspended for [$time] minutes."; } public function onUserBanned() { echo 'User is banned.'; } public function onSuccess() { // Log the user in Sentry::login($user, false); } }) );