Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:79549 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 89345 invoked from network); 10 Dec 2014 23:32:01 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Dec 2014 23:32:01 -0000 Authentication-Results: pb1.pair.com header.from=jwatzman@fb.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=jwatzman@fb.com; spf=unknown; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain fb.com does not designate 67.231.145.42 as permitted sender) X-PHP-List-Original-Sender: jwatzman@fb.com X-Host-Fingerprint: 67.231.145.42 mx0a-00082601.pphosted.com Linux 2.5 (sometimes 2.4) (4) Received: from [67.231.145.42] ([67.231.145.42:36084] helo=mx0a-00082601.pphosted.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8F/20-19688-FE7D8845 for ; Wed, 10 Dec 2014 18:32:00 -0500 Received: from pps.filterd (m0044008 [127.0.0.1]) by mx0a-00082601.pphosted.com (8.14.5/8.14.5) with SMTP id sBANVBbx030335 for ; Wed, 10 Dec 2014 15:31:56 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fb.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-id : content-transfer-encoding : mime-version; s=facebook; bh=Tpu24rGJrETdajhpeP3GgUO17hbz6nsk2f9idee37h8=; b=F2C4U4lC7jMCmGVITZR7MdI8ZAMjFAO2t2SsjjA/jMNC7fTyqClW7DuRhPYnDdOOPDZa dZupw45mjgyGcPwZfbhDOyWV25C/ckjBM0WpiZE7EpFWyfJtdVzIICIiQjn8XwxpEUaY 1IN8pTjWwroIQN7LUIWc+IQw5UqVy2W9t60= Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-00082601.pphosted.com with ESMTP id 1r6hjcsvw5-1 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 10 Dec 2014 15:31:55 -0800 Received: from m0044008 (m0044008 [127.0.0.1]) by pps.reinject (8.14.5/8.14.5) with SMTP id sBANVtFe030454 for ; Wed, 10 Dec 2014 15:31:55 -0800 Received: from mail.thefacebook.com ([199.201.64.23]) by mx0a-00082601.pphosted.com with ESMTP id 1r6hjcsvw3-2 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=OK); Wed, 10 Dec 2014 15:31:55 -0800 Received: from PRN-MBX02-2.TheFacebook.com ([169.254.5.125]) by PRN-CHUB11.TheFacebook.com ([fe80::80d:37ff:4b6a:a4fc%12]) with mapi id 14.03.0195.001; Wed, 10 Dec 2014 15:31:54 -0800 To: Robert Stoll CC: Andrea Faulds , PHP internals Thread-Topic: [PHP-DEV] [RFC] Nullsafe calls Thread-Index: AQHQFATxvp9RjOsogUO8aMy5/EMi+5yJmRsAgAAfIACAAAKqAIAAEHkAgAA1rQA= Date: Wed, 10 Dec 2014 23:31:54 +0000 Message-ID: References: <95A581EE-A062-4926-BE44-BCA87FC9B356@fb.com> <9230CB24-22FC-4A0E-A9D5-F02523B65A02@ajf.me> <583B9A4B-68FD-4FB1-B043-0D86E2480EAD@fb.com> <324758A2-E3A6-46C1-9209-998F7E936B77@ajf.me> <002701d014b6$a763bfc0$f62b3f40$@tutteli.ch> In-Reply-To: <002701d014b6$a763bfc0$f62b3f40$@tutteli.ch> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [192.168.16.4] Content-Type: text/plain; charset="iso-8859-1" Content-ID: <26FAC4EF9E87E24EB88092C61AA72C7D@fb.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.13.68,1.0.33,0.0.0000 definitions=2014-12-10_09:2014-12-10,2014-12-10,1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=fb_default_notspam policy=fb_default score=0 kscore.is_bulkscore=1.60982338570648e-15 kscore.compositescore=0 circleOfTrustscore=71.128 compositescore=0.994849863700292 urlsuspect_oldscore=0.994849863700292 suspectscore=0 recipient_domain_to_sender_totalscore=0 phishscore=0 bulkscore=0 kscore.is_spamscore=0 recipient_to_sender_totalscore=0 recipient_domain_to_sender_domain_totalscore=8891 rbsscore=0.994849863700292 spamscore=0 recipient_to_sender_domain_totalscore=0 urlsuspectscore=0.9 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1402240000 definitions=main-1412100224 X-FB-Internal: deliver Subject: Re: [PHP-DEV] [RFC] Nullsafe calls From: jwatzman@fb.com (Josh Watzman) >> .huh? I'm not talking about exceptions the object itself throws. In PHP = 7, if Nikita's RFC passes, trying to call a method on >> NULL will throw an exception. That largely negates the need for a specia= l operator, since you can just catch the exception. >>=20 >> Thanks. >> -- >> Andrea Faulds >>=20 >=20 > I think it is a matter of taste whether you use try/catch as control stru= cture or only as exception handling. I for > myself usually try to avoid using it as control structure and thus would = write something like: > if($a !=3D=3D null){ > $a->foo(bar()); > } >=20 > And for this case the ?-> operator seems perfect for me Yeah, this is exactly the point I was trying to make, sorry it wasn't clear= : that when to use exceptions are up to taste, and in my taste (and others'= ), catching exceptions here aren't appropriate in the slightest. (Not that = *throwing* them is wrong -- if you expect that object to be non-null, then = throwing one is great -- my problem is with dealing with that failure by im= mediately catching it. See my original post for the extended explanation.) So I find this operator really useful here. Josh