Re: [VOTE] User Defined Operator Overloads
| From: | Jordan LeDoux | Date: | Wed, 05 Jan 2022 19:11:07 +0000 |
| Subject: | Re: [VOTE] User Defined Operator Overloads | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-116818@lists.php.net to get a copy of this message | ||
On Wed, Jan 5, 2022 at 6:33 AM Andreas Hennings <andreas@dqxtech.net> wrote:
> Hello Jordan,
> do you have any thoughts about these symmetric/left/right modifiers,
> to get rid of the $operandPos parameter?
>
> To me, the parameter could be the kind of thing where in hindsight we
> ask "why?".
>
> Also, can we drop the "public" modifier, if we do a new version of the RFC?
>
> Cheers
> Andreas
>
It's a totally different design concept (symmetric/left/right) and I've
been going over the design implications before I responded. For instance,
wouldn't this be a special case of method overloading? You're overloading
according to a modifier, not the typing, but there is that to contend with.
If someone defined
symmetric operator + and left operator + which would
be used? (My feeling is left as its more specific.) How would they be
stored within the zend_class_entry? Since they would technically have the
same name, something would need to happen for them to not be in the
function table.
The public modifier is not required (as stated in the RFC), you can just
add it if you want. Are you asking for public operator to produce a
compile error?
Jordan