type I interface { m()bool }
type T struct { x bool }
 func (o T) m()bool { return o.x }    // o:object
 func (p *T) m()bool { return p.x }   // p:pointer

both does not work. it is not possible to implement I for T and *T ( m
already defined )

func fi(i I){}
func fp(i*I){}

fi(o) if  T implements I
fi(p) if *T implements I

fp(p) or fp(&o) does not work at all, cause i dont know, how to implement
*I
looks little strange to me.

if T implements I than, p*T references/pointsto something implementing I,
and
  func(i*I){}(p)  and
  func(i I){}(o) should work
?!

why not something like 'struct T implements I {}'
could be checked and user of T would know what T can do / where T can be
used (what T is intended to be)

if there is a type T implementing about 20 methods
do i have to search all interfaces for what interface actual is implemented
by this type ?
check for I asking for m1
check for I asking for m2
check for I asking for m1 and m2 .. (20 methods, lot of possibilities..)

thanks++, Andi

-- 
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.
To view this discussion visit 
https://groups.google.com/d/msgid/golang-nuts/CAFxc85Wz2Jozsx_fsJJD2Kca64EHivF5w-P_54VQw%3DKTZY6UuA%40mail.gmail.com.

Reply via email to