On 2018-01-13 01:37, 'Axel Wagner' via golang-nuts wrote:
> uhm, there is a bit of a mix-up with the yes-vs-no thing and negating.
> I'm apparently a bit tired, disregard the actual "no" and focus on the
> rest of the reply, explaining why what you want can't be done :)

I must admit, I'm seriously in doubt about whether we are addressing the
same questions.
It seems that you already did provide an example of how to do what I
wanted - using reflection.
I've never made it a criteria to not use reflection. Only to not use
unsafe (like using InterfaceData() to get the uintptr).

I'm perfectly happy with the .Elem().Interface() solution. AFAICS it
does what I want.

Now, regarding whether it would be ambiguous to make it a language
feature is another question.

It seems to Go compiler already has such code built in when
dereferencing pointers in selectors. However, it explicitly blocks
automatically dereferencing a pointer-to-pointer-type.

>From src/cmd/compile/internal/gc/typecheck.go:

=======
 } else if tt.Etype == types.Tptr && tt.Elem().Etype == types.Tptr &&
eqtype(derefall(tt), derefall(rcvr)) {
                                yyerror("calling method %v with receiver
%L requires explicit dereference", n.Sym, n.Left)
=======

/Peter

-- 
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