Re: [RFC] Operator Overrides -- Lite Edition
| From: | Rob Landers | Date: | Sat, 29 Jun 2024 09:15:54 +0000 |
| Subject: | Re: [RFC] Operator Overrides -- Lite Edition | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-124016@lists.php.net to get a copy of this message | ||
On Sat, Jun 29, 2024, at 02:13, Jordan LeDoux wrote:
>>> 4. The
static distinction is also fairly meaningless,
>>> as in PHP there is no situation possible where an operator overload can occur WITHOUT it operating
>>> on objects themselves.
>>
>> For this, that is the wrong approach. The actual behavior is on the type, not the instance.
>> The object instances may not even know their value, they merely represent the value.
>
> A GMP object instance that does not know its value? What are you even talking about? Can you
> show me some code explaining what you mean? I had literally months of this argument for the operator
> overloads RFC, and studied the overload implementations in six other languages as part of writing
> that RFC, I feel like I understand this topic fairly well. But I do not understand what you are
> saying here.
A few minutes ago, I sent an email where I accidentally made the code non-static, and I think I see
the merit in what you are saying. It felt so natural to use $this that I didn't even realize I
was doing it wrong.
So, looking at your RFC and mine, I think this can be improved.
What would you suggest it look like and then we can work backwards from there?