Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:96747 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 90283 invoked from network); 6 Nov 2016 20:59:32 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Nov 2016 20:59:32 -0000 Authentication-Results: pb1.pair.com smtp.mail=david.proweb@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=david.proweb@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.41 as permitted sender) X-PHP-List-Original-Sender: david.proweb@gmail.com X-Host-Fingerprint: 209.85.214.41 mail-it0-f41.google.com Received: from [209.85.214.41] ([209.85.214.41:37915] helo=mail-it0-f41.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B0/D6-33116-2B99F185 for ; Sun, 06 Nov 2016 15:59:31 -0500 Received: by mail-it0-f41.google.com with SMTP id q124so82870059itd.1 for ; Sun, 06 Nov 2016 12:59:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=3ANylThbt1/3HIzX0rjieQtFjt6pC/DHtz3RTwyONTA=; b=FlQVj3pQFaBoMK+0B2oylwvUCvp8MBaFbBSsVbJIjs5klSr0esgA4RbE2re2xSjs2Y TIXvT5NKT5QGTPnspFrSsdSm/mqc7bU6mUTdULRzoRPShwMrEsHLKg3Is4tJ0SOa5KcV YyAcCmfulS2zt8jYnoJrTGt0gRyJadNZj1GbRd5WGGXIyjgpUZyjskAybjXoZUBuGCFN cIbzHRcxksxSnUVYAar3c8WX7JoWsU7ECV9JuBNkx5NhYbPo948JtUM1/H55AgF6Vfac njUKbtVPB3Qo90r6mNBhWK7T3Zz+jm6XaaqW23pGmvkCdiImzEWjgSlMUp6xTLlQweNt U5Ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=3ANylThbt1/3HIzX0rjieQtFjt6pC/DHtz3RTwyONTA=; b=Ci+76fYRdkvFU6kL75UQQtCslhd61sBNMGPSZoMEaEsan/3DXmfFlrlKfjbeebKSbM 1J4C1ZXZ0E7yf/iUU74dYvO1EOhFt6a+6RhVPcaEN6/EppX6zkHYxEuUZkdgWY7QnHXj lph1L2ltLt4BHxotev7GbQW3k0yg0hyNYkKnLcPBKyEOHqjVmlfoE+XxkCpCQoar3xub kqOU+TDeBlhOcZ5XxHKayXrqkdtTrUMl6lbnpxT5fcJvyxlvpenZxq8SpUZFxlaST0iT IMkgd9tr3X7vMY6Qt7jpJdrxlpa/leozAP1Uz7m305oBRqbjGnnz/pUe6onbzNhP4TPG jUUQ== X-Gm-Message-State: ABUngvcWfI5RoEWPH7nX9cIWa8Rl3LGc4W0PPutAf9+Xk9V6QhKkvL7REu+3hEbREjjaKV+jPC2Ph07rdaE6dg== X-Received: by 10.36.160.134 with SMTP id o128mr4505902ite.26.1478465967495; Sun, 06 Nov 2016 12:59:27 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.142.148 with HTTP; Sun, 6 Nov 2016 12:59:26 -0800 (PST) Received: by 10.107.142.148 with HTTP; Sun, 6 Nov 2016 12:59:26 -0800 (PST) In-Reply-To: References: Date: Sun, 6 Nov 2016 18:59:26 -0200 Message-ID: To: PHP Internals Content-Type: multipart/alternative; boundary=001a114be64ace1db00540a82e23 Subject: Re: [PHP-DEV] [RFC] Interval Comparison From: david.proweb@gmail.com (David Rodrigues) --001a114be64ace1db00540a82e23 Content-Type: text/plain; charset=UTF-8 I guess that the biggest problem is about the code parsing. Currently PHP should supports what you wrote, but with another meaning. And personally I think that this feature is not too common on programming language in general, once that it is possible from first format (maybe more clear too). Em 6 de nov de 2016 6:30 PM, "Fleshgrinder" escreveu: > Validating whether a number is within a closed or open interval is > currently possible only via a construct like the following: > > ``` > if (0 < $x && $x < 42) { > echo 'x is in (0, 42)'; > } > > if (0 <= $x && $x <= 42) { > echo 'x is in [0, 42]'; > } > ``` > > It is not very readable and repetitive. It would be interesting to > support a more mathematical notation for this: > > ``` > if (0 < $x < 42) { > echo 'x is in (0, 42)'; > } > > if (0 <= $x <= 42) { > echo 'x is in [0, 42]'; > } > ``` > > I cannot judge how complicated it is to extend the Bison definitions to > allow this. However, if there is interest I'm sure there is a way. :) > > -- > Richard "Fleshgrinder" Fussenegger > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --001a114be64ace1db00540a82e23--