Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:91934 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 17167 invoked from network); 25 Mar 2016 03:25:27 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Mar 2016 03:25:27 -0000 Authentication-Results: pb1.pair.com header.from=php@golemon.com; sender-id=softfail Authentication-Results: pb1.pair.com smtp.mail=php@golemon.com; spf=softfail; sender-id=softfail Received-SPF: softfail (pb1.pair.com: domain golemon.com does not designate 209.85.217.170 as permitted sender) X-PHP-List-Original-Sender: php@golemon.com X-Host-Fingerprint: 209.85.217.170 mail-lb0-f170.google.com Received: from [209.85.217.170] ([209.85.217.170:35474] helo=mail-lb0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 34/4E-15440-3AFA4F65 for ; Thu, 24 Mar 2016 22:25:24 -0500 Received: by mail-lb0-f170.google.com with SMTP id bc4so42212572lbc.2 for ; Thu, 24 Mar 2016 20:25:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=golemon-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to; bh=Glua8qKENRFr9RqaJmcusyi2ZGrNdSC3Xu3Psf8pIiw=; b=TiH05RNItC6WPGKcLpApmKsD3MQkYLeuwaD4YdIZIka6h+uMby90jia8CGKmpCexk1 1H9KeeH3E5MeIJvdp3cJDGBcyTzUYn5gtogikftHiQ89upNmKE0b63keoYkvgKxCsw0a FdrsAHZoKAtsvvDdKXcWHnMCecNsYHTnBlML8klq0xkbkDqXh+DIYaQ0jprezF+1ELoF NcwXuxtwECVI5+UES9GbP1hYtSzpJ8THE34OhHyqebHYj1FK1rRuLiz7Diz34w1Iy2MP rPo+NAaFxhIxFWFq5MD0GdoXFijQml6QRklzJ1nnIbZEP3rHbKfEvo4J205QIrxWfVmn HPqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:date :message-id:subject:from:to; bh=Glua8qKENRFr9RqaJmcusyi2ZGrNdSC3Xu3Psf8pIiw=; b=RHQbiavgG/oKVvln6jzmyCKOPTDPb1VKPQCmYL0Bfk34mGbNTbVVHegB9A4O0J6GLW TTPes0HSronlZ5jktcNMqI3O+HcnKcsAU9RmEr/QeyHv3uh6IVGqjj4Tt3wGpi6kUgNF Pic8GW3+5Ik5f11Ug1KMlkGmj3EGBuAjQEEPQJRuues8oWQ8CZfGupnJ7t2SW8Kd+HHO rEO4S96ruEoAwJo5LFVvJnYTjWLiGYs5I6YRpcwDXpp6seSRXsRK3RL0gIO7cbusRJ/5 bO7OTcP69fFfoh+4BD929DU96a9pQYbsK92zvydB2BWbzORa0PVblb8wDD86L3gnKcnd aReg== X-Gm-Message-State: AD7BkJKr1UjuBTR4lKvx+dUE1pWhtgBdf3X9HuAheDudo2BzCq2uMAs1gqQ8j/MGOG5+Hc/wd4xQ02Dg7FFTFA== MIME-Version: 1.0 X-Received: by 10.112.135.39 with SMTP id pp7mr3854597lbb.43.1458876320713; Thu, 24 Mar 2016 20:25:20 -0700 (PDT) Sender: php@golemon.com Received: by 10.112.18.75 with HTTP; Thu, 24 Mar 2016 20:25:20 -0700 (PDT) X-Originating-IP: [107.198.91.68] In-Reply-To: References: Date: Thu, 24 Mar 2016 20:25:20 -0700 X-Google-Sender-Auth: e197DljYmNngxhCe8UaKmQiIZ0E Message-ID: To: PHP internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [RFC] [Vote] Short Ternary Assignment Operator From: pollita@php.net (Sara Golemon) On Thu, Mar 24, 2016 at 11:12 AM, Sara Golemon wrote: > After some discussion (and realizing the referenced implementation > needed more work that a simple replacement of tokens), I've decided > the close this vote, work with Midori on both implementations some > more, and reopen at a later time with a complete implementation > (possibly combined with ??=) > https://github.com/php/php-src/compare/master...sgolemon:short-ternary.coalesce I've gone from scratch to implement this branch which doesn't introduce any new opcodes, but it does add a new AST kind which is compiled into something closely (but not quite) resembling a regular short ternary. It cheats slightly by assuming that since child[0] comes from a `variable` in the parser that zend_compile_var() on it will always yield IS_CV/IS_VAR, and I've got an assert in to guard on that, but a second set of eyes would be nice there. You'll notice there's a new runtime check in ZEND_JMP_SET to handle the IS_INDIRECT case (which I see resulting from the dim/obj paths. It's hidden behind an existing check for IS_VAR/IS_CV, so anything producing a TMP won't hit it. Hopefully it's not too harsh. Based on feedback, I hope to add the ??= version of this implementation as another commit and let Midori unify the two RFCs into one. (unless someone objects to that) -Sara