Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:90013 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 96671 invoked from network); 4 Jan 2016 22:37:03 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Jan 2016 22:37:03 -0000 Authentication-Results: pb1.pair.com header.from=smalyshev@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=smalyshev@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.49 as permitted sender) X-PHP-List-Original-Sender: smalyshev@gmail.com X-Host-Fingerprint: 209.85.220.49 mail-pa0-f49.google.com Received: from [209.85.220.49] ([209.85.220.49:35830] helo=mail-pa0-f49.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C4/00-07292-E04FA865 for ; Mon, 04 Jan 2016 17:37:03 -0500 Received: by mail-pa0-f49.google.com with SMTP id do7so3126954pab.2 for ; Mon, 04 Jan 2016 14:37:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-type:content-transfer-encoding; bh=a1UtXE7l6sCqH6ZPa6GNiES2aCwdpa1Z56OA06dPPIE=; b=FFrvsXCVqygQkxJOK+Dv6zWl2XBWZbJArVV9HNMEXgqb+4Ly6XhVJu/Vm0nPfWrUOs amfoejuPJeYB+rn/vwJYtTzwUHdAv2+GQTVUradNFZ2nkzXQZLItKZH9zYsCHanXe5GT 7vsef2vGQwA7fqChpzCdrYT0FIsZ4/V0GNzGbmCRedZPqYAFSnMkgUgWK3XnpG6UPuGK cZvixvnbU2Zeje+PIB9yLkG8OO3qtVh68tMJs920Z21InMR5c4HpG/Bt8JUPh0QyeoEP dYiqxlOEB4gwjJymSe4y66c/X7PH9W7trLMxkQYR0gKo7NZSXQ4izmIYE4MwNncCj4uN 5vfw== X-Received: by 10.66.163.231 with SMTP id yl7mr126567349pab.141.1451947019725; Mon, 04 Jan 2016 14:36:59 -0800 (PST) Received: from Stas-Air.local ([205.154.255.147]) by smtp.gmail.com with ESMTPSA id sy5sm128437951pac.5.2016.01.04.14.36.56 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 04 Jan 2016 14:36:56 -0800 (PST) To: Andrea Faulds , internals@lists.php.net References: <12.34.07292.41F9A865@pb1.pair.com> X-Enigmail-Draft-Status: N1110 Message-ID: <568AF408.6020105@gmail.com> Date: Mon, 4 Jan 2016 14:36:56 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <12.34.07292.41F9A865@pb1.pair.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Re: RFC Operator Overloading in Userspace From: smalyshev@gmail.com (Stanislav Malyshev) Hi! > constraint on function parameters and return types. I think it would be > more worth pursuing a Haskell-style approach in PHP, most likely with a > hierarchy of magic interfaces. I agree that interface approach looks better than Python/C++ approach for PHP. One thing it also allows is introducing things in a gradual and conceptually sound manner - i.e. Comparable, Numeric, etc. which would implement specific operator set instead of just letting people implementing random bag of operators. I'm not sure how to make it technically but it looks better to me conceptually. We don't have as powerful type system as Haskell but I think we still can do a lot with interfaces. > should work on all number types. I don't think GMP currently overloads > any of these, though, and there is the possibility we might create > confusion if overloading extended to math functions. Which reinforces the point above that maybe before the are tackling the operators in userspace we need to identify use cases and create structure for them, and then it might be easier for us to avoid inconsistencies. We're kind of moved forward with GMP without doing that, but fortunately it's easier to fix such things while it's confined to the engine/extensions. Once it's in userspace, changing it would be way harder. -- Stas Malyshev smalyshev@gmail.com