Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:116650 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 36376 invoked from network); 15 Dec 2021 15:08:48 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 15 Dec 2021 15:08:48 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id B12781804E3 for ; Wed, 15 Dec 2021 08:11:02 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 15 Dec 2021 08:11:02 -0800 (PST) Received: by mail-wr1-f45.google.com with SMTP id a9so39062461wrr.8 for ; Wed, 15 Dec 2021 08:11:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :references:from:in-reply-to:content-transfer-encoding; bh=0BV0mMCMsDyZ4VdwBN8MMSoN7euJI60MD8DI3QcayeQ=; b=CMTCMuV2+DOA8gza0FYemg538mH2fPCMARIMXZEARKI1UQPaac9R7VEq68k7OexDpW 1+D2aPfKe+mYEfC2BvmDV5tx9JO6Ol19k229nFiMgfw+NVLJ2nPGLeaWim6DQGIpIN0Q Skw7YxHJ8Qg6/ryRtqQ1stHnNN8gxz6MpWq9fHzmWKHRW36NtSsZFiDR5RBdB1spNQU2 /frbe9y/JW+w7AzD/Qwi5mVCUoMA4xG4D7A+sn7/EFAqstrNyNaT3SUBMtdubHGj9j5C kRzekh0u6Js6EVJi+Wk2Rj5mToopcZvGxUuva5CCQ7Y3s3KurSARJXqUb9QHCGlgq4tx d2Dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=0BV0mMCMsDyZ4VdwBN8MMSoN7euJI60MD8DI3QcayeQ=; b=mPrYdfpuabnsj9yczbTjYdVEm6DA8t6rdwW4ACjKSMeYAnsK0men5jMfxRcPQYYjdn UcL9wMK+uBlD+INWLl3UO2i4h+1BVDNAEfhGJJ/14lIY8l71tXas0AstYhAqjq3THZXL Cmbl4ZsGlXi+OVcdEnnIQeCyl/s8dH7BUVdy4cuq4fnbpJkLpDx6Z9unZ/4tDhLo0Cnz RSk8MS0cbpA1zVhPfpymY5xt9ixMMuGhdo9SasjGXEpiwK24KTqqdX6di95eqMPxFOvx UkTCD5ow/b9Toxh3NYHzuW+AFHU680dtgK/ucEW4aoTpIz+Up4qJivuI/UkInxes+Pbx NdKg== X-Gm-Message-State: AOAM533qz+li7jJLYCxFRL/0VUwosd3ItCzO/sx+gCIpoPkG0Gg7fNpy kQulhp9m58CvKurfixCO+lKZNRyW1WA= X-Google-Smtp-Source: ABdhPJyYHSNDlm0woXeNyh4fDuRzWq2Xwt1Gr/ku2YX54Ebl4lFo0rr3AQq58Z92CWByH8mCxINNhw== X-Received: by 2002:a5d:6351:: with SMTP id b17mr210624wrw.247.1639584661221; Wed, 15 Dec 2021 08:11:01 -0800 (PST) Received: from [192.168.0.22] (cpc104104-brig22-2-0-cust548.3-3.cable.virginm.net. [82.10.58.37]) by smtp.googlemail.com with ESMTPSA id k6sm2134416wmj.16.2021.12.15.08.11.00 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 15 Dec 2021 08:11:00 -0800 (PST) Message-ID: <5187537c-2edf-f57d-6030-f969df3b28b5@gmail.com> Date: Wed, 15 Dec 2021 16:10:58 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0 Content-Language: en-GB To: internals@lists.php.net References: <44b3fb4b-4693-1639-c8c0-5e17296c196e@gmail.com> In-Reply-To: <44b3fb4b-4693-1639-c8c0-5e17296c196e@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC] User Defined Operator Overloads (v0.6) From: rowan.collins@gmail.com (Rowan Tommins) On 15/12/2021 15:03, Dik Takken wrote: > $query->where(Price < 100); > > Here Price is a class that represents a database column which has a > (static) overload of the '<' operator. The operator overload yields an > object representing a database expression, which gets passed to the > where() method. The biggest problem with this particular example is not the operator overloading, but the bare word "Price", which is currently a constant lookup, not a class reference, as in: const Price = 50; var_dump(Price < 100); However, with any version of operator overloading that didn't limit the return values of the overloaded operator, you could do something like: $query->where(Product::$price < 100) Where the static property Product::$price is an object which overloads the "<" operator to return some kind of Condition object which can be used by the query builder. Regards, -- Rowan Tommins [IMSoP]