Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108614 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 52671 invoked from network); 16 Feb 2020 03:39:27 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 16 Feb 2020 03:39:27 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 5A8831804DA for ; Sat, 15 Feb 2020 17:54:28 -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.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, 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-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) (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 ; Sat, 15 Feb 2020 17:54:27 -0800 (PST) Received: by mail-wr1-f41.google.com with SMTP id z3so15500046wru.3 for ; Sat, 15 Feb 2020 17:54:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:user-agent:in-reply-to:references:mime-version :content-transfer-encoding:subject:to:from:message-id; bh=ovVIc9KjEwY5JSQrM6TiBAY0jXYrBsmlerJ947YeQy4=; b=TLByz7ofSL3gEfjgOudE+OP6k89rHc+EdUU4qHoKFjKChuWWzc8QP7idNwZp/OFGh8 gQ/IUpWRGCt9zJi53V5WYp7fXHUYDtlfSqyVHX8JfX8jE8Klv9sjv86m9WWV/vn9ysQi G8JeETTfAksguF4TU2MqH5vUdRiKXzsOX79mLzXicSXhephAOBVfh/EF9XuCKRMqsz1c yQWR/dmkF/6XT1LLkcteYgbTWcL4SYYRBOTLq9ao3MwTzlC9FoB5OjAL2Xe17f4bv/GL RFpc+PB/eujQA4iFzOqkhLyg7eKvc2vcDMD5CB9nPTfQDVeZkirAqIdFfhcNQt2Z2ncF H2RQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:user-agent:in-reply-to:references :mime-version:content-transfer-encoding:subject:to:from:message-id; bh=ovVIc9KjEwY5JSQrM6TiBAY0jXYrBsmlerJ947YeQy4=; b=RVVpu5GdrBk7UbrRko7X5Ip4Amy54G/A+HCki+tGryGz9E68tL5brtdrhTHTZX/tGQ DCdAhDDdNFsUTaWgdw1eSSZXp0wutvw+k4g6zseXa1h+xg30QtQu0HNODAoaNua9yDQu MiauP08JHwCrY2cGwB4N6gYO3L+9mZgmI9R5ZrqFUXFcW/Vd93eDbfa7xJGJV59MdBxd vjInYI7t1xeTBzFLVV4Qau0DKpQTvifDjXGVJt7G4gHIQ/nUeA6tIquBLAcnSmFFb78K VM6o7YcLj5P+2zQOSyyztoVLo7udsB3hcgOAD6IcpWlK+S4Vuye9hXKldOIXbHCKapH2 UGwA== X-Gm-Message-State: APjAAAXk3Pd+zBTrZ3/wCXn2D8F0W/9QApCH317IBbbdpLh4CHg5mUmJ 8yjpvQt8hYQtqhcaFINYOJGxzmnW X-Google-Smtp-Source: APXvYqxShyg2RGmcet1NrJBGYdyqDqlf5wXQ2DH50FhvZFiejCWJx+3Df3LvUrRRusU8H0PvQZjw3g== X-Received: by 2002:adf:fe4d:: with SMTP id m13mr13336140wrs.179.1581818066288; Sat, 15 Feb 2020 17:54:26 -0800 (PST) Received: from [192.168.0.12] (cpc84253-brig22-2-0-cust114.3-3.cable.virginm.net. [81.108.141.115]) by smtp.gmail.com with ESMTPSA id s8sm14273262wrt.57.2020.02.15.17.54.25 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 15 Feb 2020 17:54:25 -0800 (PST) Date: Sun, 16 Feb 2020 01:54:21 +0000 User-Agent: K-9 Mail for Android In-Reply-To: <003801d5e44c$169700e0$43c502a0$@gmx.de> References: <003801d5e44c$169700e0$43c502a0$@gmx.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable To: internals@lists.php.net Message-ID: <83988BB2-7C9D-4118-A1A2-253725F1A7EA@gmail.com> Subject: Re: [PHP-DEV] [RFC] Userspace operator overloading From: rowan.collins@gmail.com (Rowan Tommins) On 15 February 2020 22:05:52 GMT+00:00, jan=2Eh=2Eboehmer@gmx=2Ede wrote: >Some discussion points, I can think of, would be the naming of the >methods >(maybe naming them after the operator symbol and not the arithmetical >operation they represent, e=2Eg=2E __plus instead of __add) or putting th= e >methods inside of interfaces like done for ArrayAccess As I mentioned earlier [1] I think the answers to both of these questions = depend on a fundamental philosophical question about what you're overloadin= g: - The groups of operations which exist for built-in types e=2Eg=2E the ari= thmetic operations overloaded by GMP; or string operations overloaded by an= object with enhanced Unicode functionality=2E - The individual symbolic operators, with no intrinsic meaning - e=2Eg=2E = overloading =2E for concatenation on strings but dot-product for vectors; o= r a DSL overloading << and >> for "into" and "out of"=2E I think it would benefit the RFC to take a stance on that question, and bu= ild the feature around it=2E [1] https://news-web=2Ephp=2Enet/php=2Einternals/108347 --=20 Rowan Tommins [IMSoP]