Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:67855 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 97892 invoked from network); 26 Jun 2013 11:32:16 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Jun 2013 11:32:16 -0000 Authentication-Results: pb1.pair.com smtp.mail=joost.koehoorn@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=joost.koehoorn@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.180 as permitted sender) X-PHP-List-Original-Sender: joost.koehoorn@gmail.com X-Host-Fingerprint: 74.125.82.180 mail-we0-f180.google.com Received: from [74.125.82.180] ([74.125.82.180:57864] helo=mail-we0-f180.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id EB/92-18025-F31DAC15 for ; Wed, 26 Jun 2013 07:32:15 -0400 Received: by mail-we0-f180.google.com with SMTP id w56so10146480wes.39 for ; Wed, 26 Jun 2013 04:32:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:message-id:in-reply-to:references:subject:x-mailer :mime-version:content-type:content-transfer-encoding; bh=EoyP7kKy08L9CdNF+GFBpNdgVAE+h+LAqFrCF0xs7Bs=; b=bMPbScL0/Eicp4zJ7xsM5Mp1u9n/cy0LT7aGqiR+IywZw8QxR5p9C7Qq32KP453pvG zyx4BCu2MtjyGxP9LOQ1ybCwE5hq5iwL2HjroHUcgXR7bKCrb15roYRu8jf3iQE57shW TnU3Gfq1knRC/c2h6GYkvAUVKd7cHGELz/2yEaaprK/YjyhM0bX4sNhoGxNV2Rdrmd85 UBiQuaTigeJx0Hkm72auLwLrHQ9siNLOdtREgFJfW/ezFQeFL35Wo/yfHBJ4JGU0iih9 1avoUsqjPD8XmzBMlq30fAgv53OiFGwCie2Us6JS+1YawoHyc2H1xoHAP+6fW/yPW8tV D/rA== X-Received: by 10.194.110.6 with SMTP id hw6mr2569709wjb.3.1372246332050; Wed, 26 Jun 2013 04:32:12 -0700 (PDT) Received: from MacBook-Air-van-Joost-Koehoorn.local (178-85-180-81.dynamic.upc.nl. [178.85.180.81]) by mx.google.com with ESMTPSA id w4sm10174472wia.9.2013.06.26.04.32.10 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 26 Jun 2013 04:32:11 -0700 (PDT) Date: Wed, 26 Jun 2013 13:32:10 +0200 To: Nikita Popov , Patrick ALLAERT Cc: PHP internals Message-ID: In-Reply-To: References: X-Mailer: Airmail Beta (183) MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: =?UTF-8?Q?Re=3A_=5BPHP-DEV=5D_Announcing_RFC_'Anonymous_Catches'?= From: joost.koehoorn@gmail.com (Joost Koehoorn) On 26 juni 2013 at 08:50:55, Patrick ALLAERT (patrickallaert=40php.net) w= rote: 2013/6/25 Nikita Popov :=C2=A0 > but I'm against the generic catch=7B=7D statement.=C2=A0 I'm sharing Nikita's opinion, with the difference of a bit more=C2=A0 enthusiasm on leaving off the variable as it could make it more=C2=A0 obvious that there is no intention in using the variable, and that no=C2=A0= memory should be kept for it. This might be better than doing:=C2=A0 try =7B=C2=A0 =5B...=5D=C2=A0 =7D catch (Exception =24ignore) =7B=C2=A0 unset(=24ignore);=C2=A0 =7D=C2=A0 =5B...=5D=C2=A0 However, I see other cases where a variable is technically required=C2=A0= but not used:=C2=A0 abstract class AbstractPrinter =7B=C2=A0 abstract public function print(=24message);=C2=A0 =7D=C2=A0 class Printer extends AbstractPrinter =7B=C2=A0 public function print(=24message) =7B=C2=A0 echo =24message;=C2=A0 =7D=C2=A0 =7D=C2=A0 class BlackholePrinter extends AbstractPrinter =7B=C2=A0 public function print(=24message) =7B=C2=A0 =7D=C2=A0 =7D=C2=A0 In the previous example, =24message is not =22used=22 in=C2=A0 BlackholePrinter::print() (as well as in AbstractPrinter::print()).=C2=A0= How do you intend to make that consistent with: catch(Exception) =3F=C2=A0= Patrick Your inheritance example is something that I do not have a good solution = for (I don't think there is one) but with Exceptions it's different, beca= use there the solution is obvious, unambiguous and expected. That it also happens to be easy to implement is good to know, it means th= at the effects of this change are totally obvious (because only ONE opcod= e has to be changed, so there is only an effect on this ONE opcode, other= code is not affected in any way, that's good to know).