Should opIndex completely override alias this?

Artur Skawina art.08.09 at gmail.com
Fri May 11 12:05:13 PDT 2012


On 05/11/12 20:40, Mehrdad wrote:
> On Friday, 11 May 2012 at 18:32:12 UTC, Artur Skawina wrote:
>> Since it is a function template the attributes are inferred, in this case from data's opIndex, if any. The arguments are forwarded as-is, ie data's opIndex has to deal with them.
> 
> 
> Among other things, 'scope' gets messed up.

How? By making the forwarder not callable w/ a scoped argument, when the
target function would be? It isn't a problem for operator overloading, as
the signature(s) are known. But in general, scope-inference would be needed.
Which has similar problems as 'uniq', for non-trivial function bodies. 

Yes, things aren't perfect; eg 'this' attributes/classes like shared or const
also need explicit handling (recent frontend changes apparently improved the
situation a bit).

artur


More information about the Digitalmars-d mailing list