Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:90121 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 46493 invoked from network); 5 Jan 2016 18:17:22 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Jan 2016 18:17:22 -0000 Authentication-Results: pb1.pair.com header.from=php@golemon.com; sender-id=softfail Authentication-Results: pb1.pair.com smtp.mail=php@golemon.com; spf=softfail; sender-id=softfail Received-SPF: softfail (pb1.pair.com: domain golemon.com does not designate 209.85.217.194 as permitted sender) X-PHP-List-Original-Sender: php@golemon.com X-Host-Fingerprint: 209.85.217.194 mail-lb0-f194.google.com Received: from [209.85.217.194] ([209.85.217.194:33834] helo=mail-lb0-f194.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E1/6C-12097-1B80C865 for ; Tue, 05 Jan 2016 13:17:22 -0500 Received: by mail-lb0-f194.google.com with SMTP id jk7so14873750lbc.1 for ; Tue, 05 Jan 2016 10:17:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=golemon-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=33qtHmZ64LjLFPt6XWFrhLfFWderZdhGOk0ESNfZMFE=; b=P/hBRd1cyB7kl38qFgN0hTCbQyAD0tcY1YgnSm9smXWePeckEJwpKV+JyB/vEDj1Qa iZdmHnI4WiryPfQTYJVz/X5CcKiAsmOkHK0xscMzRNuYlmMtmsQ6CVD6yDy4G5/vl4GK j6WoALd80UMALmvwLnKsux5Uyv14qIyOu4DJWWsAx24tF8OecL+KyVugNCOPFTw4vbIO VGU6DesES1zqLFhNPxYo+e9aQ/FvckZlRbdvqxOHmbtc2iD8njnHnz5FlF8znCQbgftK GPX4WqkIwtSsqds7boKcWAJ49JRO4MgM1PXieaeG1o8IcpObWSUcYCb3+Z8GzBElkiSP whDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=33qtHmZ64LjLFPt6XWFrhLfFWderZdhGOk0ESNfZMFE=; b=XRRMP6mLkAVc2V09yKkdhlQZvkRiTZ4D2GhZKw3FM/cgaWGsLoIUY8D5BXCkaIhmsF 5QORoOO/EwMpclu7e14y/rxRIfitrr+n6gLdvaYqeq+x0E0ubwNAECNOndrjdMWZ0Gk0 0bFWF1jqTV4c2kdYKfy2KEHNS4LBkUTtNNxsyBLihCejUOPS7N1gQBR1IaWiOZEvJFl4 R4w1FTEHSI+dSnPTXodmrRDyYIJfcNynJ3EQRVRZkV5S46+xnUFozoIXdLd/ArqPSk44 3dkPIRn+hPzviV0ofuBH02JcB+0ArR0EESmtuefIbul3fI+tc0MWciIvepvY/KRctf4e kFMQ== X-Gm-Message-State: ALoCoQnqP+CXoHHE2W5Nq9gg62ZyqbCt8pCbwQTfDOOf/npI1EQyZyG9oeb4rNEmShyyi7Jf5LvEUjBchYQXaEaPdIlh6+rn4Q== MIME-Version: 1.0 X-Received: by 10.112.140.166 with SMTP id rh6mr34039318lbb.77.1452017837855; Tue, 05 Jan 2016 10:17:17 -0800 (PST) Sender: php@golemon.com Received: by 10.112.37.44 with HTTP; Tue, 5 Jan 2016 10:17:17 -0800 (PST) X-Originating-IP: [107.198.91.68] In-Reply-To: References: Date: Tue, 5 Jan 2016 10:17:17 -0800 X-Google-Sender-Auth: 5rGAm93NNPjnjW6OogePp1W5rmk Message-ID: To: Nikita Popov Cc: PHP internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] [RFC] Differentiate op from assign-op in operator overloading From: pollita@php.net (Sara Golemon) On Mon, Jan 4, 2016 at 1:39 AM, Nikita Popov wrote: > I'd like to provide some context as to why the current implementation works > as it does. > Thanks for the context, Niki. It makes sense that, with GMP as the flagship target of operator overloading, stripping away the by-ref semantics of objects would be appealing. This way GMP objects just look like regular numbers. Except they're not. Nor are they really objects at this point. They have no methods, no properties, they're not instantiated with the new keyword, and they have by-value semantics (mostly). That feels really odd to me, that GMP objects, at the moment of their inception were /designed/ to be non-object objects. Would this carry forward to any OOP API we might introduce in the future? i.e. $g->add(123); wouldn't muttate $g, but would return a new instance? Leaving GMP out of the equation for now (and I think we need to have a longer discussion about this, but in another thread), I think the question which remains is: Do we want more non-object objects? Should, for example, SimpleXMLbe constrained by GMP's goals when implementing overloaded operators (no, I don't know what this would look like, it's just a for-instance). If the answer to that is "No" (which I think it is), then the question is: Can we modify the do_operation API in a way that allows GMP to remain psuedo-by-value while still allowing other internal objects which implement overloading to be more correct? I think we can. I'll cobble together a gist of how that might look if there's tentative buy-in, but I'm pretty sure PHP7's variable model does let us do that. -Sara