On Friday, October 14, 2016 09:09:33 Marc Schütz via Digitalmars-d-learn 
> On Thursday, 13 October 2016 at 01:09:06 UTC, Ali Çehreli wrote:
> > On 10/10/2016 12:01 PM, Yuxuan Shui wrote:
> >> Hi,
> >>
> >> Why is there no opIndexDispatch for overloading a[x].func() ?
> >
> > I could not understand the question fully but would using an
> > element proxy work?
> I assume a proxy would indeed work, but it's indeed inconsistent.
> A proxy would work for opIndexAssign() and friends as well, so
> why do they exist, when opIndexDispatch() doesn't?

Presumably, because it  didn't occur to anyone when the others were added.
And most stuff implementing opIndex is likely to have it return by ref. But
opDispatch is kind of a weird beast to begin with. There are a few cases
where it's really useful, but in general, it's not used much. And I'm pretty
sure it's one of the overloaded operators that was added later on given that
most of them existed in different forms before we used templated functions
with strings for overloaded operators, whereas opDispatch requires a
compile-time string. So, when the decision to add the opIndex* functions in
addition to opIndex was made, opDispatch probably hadn't even been proposed

- Jonathan M Davis

Reply via email to