I think D solved this quite well

https://dlang.org/spec/template.html

In your example this might become

type Foo(type T) interface {}
type Bar(type T) interface {

Foo!(T)

}


The exclamation point makes it clear this is the application of a T to the 
existing interface type Foo(type T).

On Friday, 14 September 2018 11:32:13 UTC+10, Patrick Smith wrote:
>
> (Apologies if this has already been brought up; I don't remember seeing 
> it.)
>
> While writing a bit of sample generics code, I ran into a nasty little 
> ambiguity:
>
> type Foo(type T) interface {}
> type Bar(type T) interface {
>
> Foo(T)
>
> }
>
>
> Does this embed the interface Foo(T) into Bar(T), or does it add to the 
> method set of Bar(T) a method named Foo taking a parameter of type T?
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to