Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:79550 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 91014 invoked from network); 10 Dec 2014 23:40:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Dec 2014 23:40:49 -0000 Authentication-Results: pb1.pair.com smtp.mail=jwatzman@fb.com; spf=unknown; sender-id=unknown Authentication-Results: pb1.pair.com header.from=jwatzman@fb.com; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain fb.com does not designate 67.231.153.30 as permitted sender) X-PHP-List-Original-Sender: jwatzman@fb.com X-Host-Fingerprint: 67.231.153.30 mx0b-00082601.pphosted.com Linux 2.5 (sometimes 2.4) (4) Received: from [67.231.153.30] ([67.231.153.30:8752] helo=mx0a-00082601.pphosted.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 96/80-19688-EF9D8845 for ; Wed, 10 Dec 2014 18:40:48 -0500 Received: from pps.filterd (m0004003 [127.0.0.1]) by mx0b-00082601.pphosted.com (8.14.5/8.14.5) with SMTP id sBANcZc6023016 for ; Wed, 10 Dec 2014 15:40:44 -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=LpC4bIxRP11ow/P5NEm4/jG2ui5K5WYAh8+BE5A9NLE=; b=jeVzdE+umb226r5vxWvpSb/iYupMQMMbDKvIXvxlBnLndncP3yabP9B7rbsUkIP6qAeR cYrwhJCOdoTLuUsLCFKQQSJ4Fc+lhEFVlo3g9EjDQBRrXQxSRtMe4Be+Fh3tmPLrAJcG xr3qdaz6M73sZYPyZ/2wOe6vknZkgYSXCIM= Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-00082601.pphosted.com with ESMTP id 1r6wya0gn4-1 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 10 Dec 2014 15:40:44 -0800 Received: from m0004003 (m0004003 [127.0.0.1]) by pps.reinject (8.14.5/8.14.5) with SMTP id sBANehP6025394 for ; Wed, 10 Dec 2014 15:40:43 -0800 Received: from mail.thefacebook.com ([199.201.64.23]) by mx0b-00082601.pphosted.com with ESMTP id 1r6wya0gn1-1 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=OK); Wed, 10 Dec 2014 15:40:43 -0800 Received: from PRN-MBX02-2.TheFacebook.com ([169.254.5.125]) by PRN-CHUB14.TheFacebook.com ([fe80::5977:3d0b:700b:8bb%12]) with mapi id 14.03.0195.001; Wed, 10 Dec 2014 15:40:42 -0800 To: Robert Stoll CC: PHP internals Thread-Topic: [PHP-DEV] [RFC] Nullsafe calls Thread-Index: AQHQFATxvp9RjOsogUO8aMy5/EMi+5yJh4YAgAAo4YCAAB3TAIAANUYA Date: Wed, 10 Dec 2014 23:40:41 +0000 Message-ID: References: <95A581EE-A062-4926-BE44-BCA87FC9B356@fb.com> <000b01d01494$bb1c6520$31552f60$@tutteli.ch> <002801d014b8$151ec360$3f5c4a20$@tutteli.ch> In-Reply-To: <002801d014b8$151ec360$3f5c4a20$@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: <29A92A761311A24897A6098CC3EDCFC6@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-1412100225 X-FB-Internal: deliver Subject: Re: [PHP-DEV] [RFC] Nullsafe calls From: jwatzman@fb.com (Josh Watzman) On Dec 10, 2014, at 12:30 PM, Robert Stoll wrote: > I stick with it, evaluating it does not make sense IMO. If I want to exec= ute it in any case then I would do something > like this currently >=20 > $g =3D g(); > $h =3D h(); > if($x !=3D=3D null){ > $x->foo($g, $h)->bar(baz()); > } >=20 > And with the ?-> operator: >=20 > $g =3D g(); > $h =3D h(); > $x?->foo($g, $h)?->bar(baz()); >=20 > Where I do not expect that baz() is called. You can make exactly the opposite argument too, though. I *do* expect that = baz() would be called, and I can always explicitly write it the other way i= f that happens to not be what I want at some point. > You wrote it will be confusing for the user if the arguments would not be > evaluated. I do not think so, telling them it is a short form for ($x != =3D=3D null ? $x->foo() : null) is very easy and > straight forward for the user to pick up. I think it's confusing the other way, and "instead of raising a fatal for c= alling a method on null, it returns null" is just as simple of an explanati= on. > Therefore, please dig up a better example. Yeah, gonna go do this now, had a busy morning :) All of that said: it's not clear to me that this actually matters that much= . I wasn't able to quickly find an example because the vast majority of the= Hack code I have that uses this operator isn't actually affected one way o= r the other. Josh