Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:69313 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 95547 invoked from network); 24 Sep 2013 12:25:25 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Sep 2013 12:25:25 -0000 Authentication-Results: pb1.pair.com smtp.mail=terence.copestake@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=terence.copestake@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.128.54 as permitted sender) X-PHP-List-Original-Sender: terence.copestake@gmail.com X-Host-Fingerprint: 209.85.128.54 mail-qe0-f54.google.com Received: from [209.85.128.54] ([209.85.128.54:38899] helo=mail-qe0-f54.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AD/01-24892-3B481425 for ; Tue, 24 Sep 2013 08:25:24 -0400 Received: by mail-qe0-f54.google.com with SMTP id cy11so3020885qeb.41 for ; Tue, 24 Sep 2013 05:25:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=OBsvwth2tMkVRNGYR28Ew+x4Ngaa305MvV6RJphzJCo=; b=FgvUXKGj++eDKMcGMOYbzmbLMcN8hWHs5l0LaNGDb3c1gXZRdCXFAHNNqNhTKqULZF NRJmBoIuq/JODuewSEUss4PCEFM8AczokbhVbkQH9rGlXfjFyn5SskZ5UlYnF8+UBjkb MV4qKJx7aDqQKzG0FGTOEtX3vTGYb5R8G8P4fYyrmAeh2YArGJSkFnJ6m3tXG/f3vKJ5 EMGKzkOIYtEJTEFh3GYpM/XgRCF74YpoMP/N4jkJukbYEC42x0QdmayYNPzjH46tcgQO DH6+jrqBrMpr9HzQws5VhfbJoc5PU7UcP3FtzvViDmdX5zfVhrKNhKR9k6IanVAFiuxw PRHw== MIME-Version: 1.0 X-Received: by 10.224.98.200 with SMTP id r8mr28910455qan.26.1380025521377; Tue, 24 Sep 2013 05:25:21 -0700 (PDT) Received: by 10.140.90.69 with HTTP; Tue, 24 Sep 2013 05:25:21 -0700 (PDT) In-Reply-To: References: Date: Tue, 24 Sep 2013 13:25:21 +0100 Message-ID: To: David Soria Parra Cc: "internals@lists.php.net" Content-Type: multipart/alternative; boundary=089e01536b7cfb969404e7203a3f Subject: Re: [PHP-DEV] RFC: Anonymous Classes From: terence.copestake@gmail.com (Terence Copestake) --089e01536b7cfb969404e7203a3f Content-Type: text/plain; charset=ISO-8859-1 Playing devil's advocate here, could this feature make the language more expressive? Take for example an API where you'd typically wrap a method call in try/catch blocks to handle the various "outcomes" e.g. a user login, you'd maybe have a UserDisabled exception, a UserAlreadyLoggedIn exception, a UserPasswordIncorrect exception, etc. With the addition of this syntactic sugar, the method could instead accept an anonymous class with a onDisabled, onLoggedIn, onPasswordIncorrect methods. Perhaps it would also have a performance benefit over cascading through catch blocks? Though someone else would have to confirm that. --089e01536b7cfb969404e7203a3f--