UFCS for D
Steven Schveighoffer
schveiguy at yahoo.com
Mon Apr 2 06:23:08 PDT 2012
On Fri, 30 Mar 2012 20:25:10 -0400, Walter Bright
<newshound2 at digitalmars.com> wrote:
> 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.
As I mentioned, this is the horrible solution I did not wish to have :(
What is wrong with my proposal (item 2 from my original post)? It seems
like it would be as easy to implement as your proposal, and does not
create "local" instantiations.
-Steve
More information about the Digitalmars-d-announce
mailing list