One way of avoiding this muddle between pointer and value methods would be 
to require that any type parameter (T say) which is subject to a contract 
cannot be replaced by a pointer type.

The contract could then be absolutely explicit about whether a method's 
receiver were T or *T and any generic function using this contract wouldn't 
compile if the method were called inappropriately.

This,of course, wouldn't prevent you from using ordinary/return parameters 
of type *T or some aggregate type based on *T. Nor would it prevent type 
parameters which were not subject to a contract from being replaced by 
pointer types.

Alan

-- 
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 on the web visit 
https://groups.google.com/d/msgid/golang-nuts/f953cf6b-dcb3-4d9f-9c4f-6b38990b74e5%40googlegroups.com.

Reply via email to