Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:89978 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 14402 invoked from network); 3 Jan 2016 12:50:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Jan 2016 12:50:29 -0000 Authentication-Results: pb1.pair.com header.from=mark@lange.demon.co.uk; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=mark@lange.demon.co.uk; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain lange.demon.co.uk from 91.221.168.45 cause and error) X-PHP-List-Original-Sender: mark@lange.demon.co.uk X-Host-Fingerprint: 91.221.168.45 mdfmta004.mxout.tbr.inty.net Received: from [91.221.168.45] ([91.221.168.45:57015] helo=smtp.demon.co.uk) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id EC/61-28689-31919865 for ; Sun, 03 Jan 2016 07:50:27 -0500 Received: from mdfmta004.tbr.inty.net (unknown [127.0.0.1]) by mdfmta004.tbr.inty.net (Postfix) with ESMTP id B96ACA0C08A for ; Sun, 3 Jan 2016 12:49:29 +0000 (GMT) Received: from mdfmta004.tbr.inty.net (unknown [127.0.0.1]) by mdfmta004.tbr.inty.net (Postfix) with ESMTP id 96F85A0C081 for ; Sun, 3 Jan 2016 12:49:29 +0000 (GMT) Received: from [192.168.1.64] (unknown [86.135.237.93]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by mdfmta004.tbr.inty.net (Postfix) with ESMTP for ; Sun, 3 Jan 2016 12:49:29 +0000 (GMT) To: internals@lists.php.net References: Message-ID: <56891917.7040803@lange.demon.co.uk> Date: Sun, 3 Jan 2016 12:50:31 +0000 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-MDF-HostID: 9 Subject: Re: [PHP-DEV] RFC Operator Overloading in Userspace From: mark@lange.demon.co.uk (Mark Baker) On 03/01/2016 02:14, Sara Golemon wrote: > Patricio Tarantino has asked me to help him propose Operator > Overloading in PHP 7.1 (based in part on my operator extension in > PECL). I think we can expose this to usespace as magic methods with > very little overhead (the runtime check and dispatch is already there, > after all). > > https://wiki.php.net/rfc/operator-overloading It's something I'd love to see, and would be particularly useful for my Complex Number and Matrix libraries, but (as Bishop says) the large list of magic methods does feel excessive, and a single dispatcher method feels simpler. But how then would it be possible to overload several operators? If the __overload() dispatcher method has to implement a switch on the value of the operator argument, and implement error handling for invalid or non-implemented operators, it's pushing a lot of complexity into that magic method -- Mark Baker _________ |. \ \-3 |_J_/ PHP | || | __ | || |m| |m| I LOVE PHP