Hi!

On 12/17/21 9:43 AM, Matt Fonda wrote:
Hi Jordan,

Thanks for the RFC. I have a couple questions:

Suppose I have classes Foo and Bar, and I want to support the following
operations:

- Foo * Bar (returns Foo)
- Bar * Foo (returns Foo)

If I understand correctly, there are three possible ways I could implement
this:

And that's one of the reasons I feel so uneasy with this. When reading this code: $foo * $bar - how do I know which of the ways you took and where should I look for the code that is responsible for it? When I see $foo->times($bar) it's clear who's in charge and where I find the code. Terse code is nice but not at the expense of making it write-only.

--
Stas Malyshev
smalys...@gmail.com

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to