Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:69228 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 82577 invoked from network); 19 Sep 2013 09:10:27 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Sep 2013 09:10:27 -0000 Authentication-Results: pb1.pair.com header.from=leight@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=leight@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.49 as permitted sender) X-PHP-List-Original-Sender: leight@gmail.com X-Host-Fingerprint: 74.125.82.49 mail-wg0-f49.google.com Received: from [74.125.82.49] ([74.125.82.49:47698] helo=mail-wg0-f49.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B9/29-29009-28FBA325 for ; Thu, 19 Sep 2013 05:10:27 -0400 Received: by mail-wg0-f49.google.com with SMTP id l18so7476768wgh.28 for ; Thu, 19 Sep 2013 02:10:24 -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=oI6D2o/URe7HJdnNu/y6XaKPm0Hg3MVXRHj0YtWFuCg=; b=fds7Aooe8vHmpwkaIvBGiTD7qholiFNrMSxeAQaR9iEGteid3DwFcJYFOG6LR0DNVk NcZTPoxN2DCOB8x2/WbQXukYkKoT6EBuqxzw3er4iVELdRzDi5qIHQ8Ivirs3f90e0Xd UWlliwEiDINy/xEwnl68jE1IhdKZeYejmMU2/KG8lcIscO5Ci9TIdjFtvL5yd8W3l1Py ZaibtgziG2uN6g8M1/rE2yl/2frsuuTgccxL7as/PthAF6XYGTj4pKITQI8UCkll2POa UcpZ9DyvxhM3TWL5K/Qa2tRtJtUk0GFB7v80uuPip02h8B/TxsYlDbqadh9yHMAy0Imc EwGg== MIME-Version: 1.0 X-Received: by 10.194.78.78 with SMTP id z14mr517402wjw.32.1379581824030; Thu, 19 Sep 2013 02:10:24 -0700 (PDT) Received: by 10.216.184.3 with HTTP; Thu, 19 Sep 2013 02:10:23 -0700 (PDT) In-Reply-To: References: <49D57F66323040FC9AE48244DAAF3771@gmail.com> <012B9378-3C3A-4169-96D3-3B57D6C7A82C@seancoates.com> Date: Thu, 19 Sep 2013 10:10:23 +0100 Message-ID: To: William Bartlett Cc: Bob Weinand , Developers List PHP Mailing Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] Re: Allowing is_* functions to accept multiple parameters From: leight@gmail.com (Leigh) On 19 September 2013 03:20, William Bartlett wrote: > I would argue that LTR support is also inconsistent / not desired. > > If I wrote: > > $i = 0; > is_three($i = $i + 1, $i = $i + 1, $i = $i + 1); > > I would certainly expect is_three to return false, but I would also expect > $i to contain three. php doesn't normally evaluate arguments lazily, it > would be weird for that behavior to suddenly crop up. users who want lazy > evaluation can write it the traditional way (with &&). I think there has been some misunderstanding of my intention here (maybe I communicated it badly) - Originally I was pretty confused when reading Bobs response as it was way beyond the scope of what I was proposing. When I say parameters evaluated LTR / boolean short-curcuit evaluation I mean it like this: $i = 1; $f = 1.1; is_int($i, $f, $i, $i) => is_int(1) && is_int(1.1) && is_int(1) && is_int(1) is_int($i++, $f++, $i++, $i++) => is_int(1) && is_int(1.1) && is_int(2) && is_int(3) $i == 4; $f == 2.1; Internally, processing will stop at the is_int(1.1) and not bother continuing to check the types of further arguments. I did not mean: is_int($i++, $f++, $i++, $i++) => is_int($i++) && is_int($f++) && is_int($i++) && is_int($i++) As Bob said, this would take some pretty nuts opcode processing, and is completely not worth the effort involved. I may have emphasised a parallel with isset() a bit too much, however isset() cannot take expressions as input. I was never intending to try and evaluate parameters as they were passed and jump over subsequent evaluations. Standard function call semantics would still apply. I hope that people find that less confusing / unexpected.