UFCS for D

Walter Bright newshound2 at digitalmars.com
Fri Mar 30 17:25:10 PDT 2012


On 3/30/2012 12:36 PM, Walter Bright wrote:
> On 3/30/2012 12:11 PM, Steven Schveighoffer wrote:
>> On Fri, 30 Mar 2012 14:27:43 -0400, Walter Bright <newshound2 at digitalmars.com>
>> wrote:
>>
>>>
>>> I would argue that:
>>>
>>> 3. An extension method for an argument of type template parameter T will be
>>> looked up only in the instantiation scope.
>>
>> I don't think you looked at my counter case in detail. Your idea leads to two
>> different instantiations of tmpl!Foo having two different implementations,
>> depending on which extension methods you include. In fact, in one place, the
>> instantiation might succeed, but in another, the instantiation might fail.
>
> Yes, you're right. I missed that nuance. I don't really know how to fix it.

Ah, I know how to fix it. Mark such instantiations as "local" ones, so they are 
mangled with the module name of where they were instantiated from.


More information about the Digitalmars-d-announce mailing list