My suggestion was that you can't use a pointer type as a type parameter if 
the latter is subject to a contract.

In the case you mention, the contract could be expressed as a disjunction 
of value and pointer methods:

contract stringer(T) {
   T String() string, *T String() string
}

However, if T were used as an ordinary/return parameter type, you would 
need two functions - one for T and one for *T - and so may be it is too 
restrictive.

On the other hand and more generally, not knowing whether the type 
parameter represented a pointer or a value might lead to some awkward 
coding. For example, you wouldn't be able to de-reference the type argument 
as it might not be a pointer.

It's clearly an area where some more thought is needed as Ian intimated 
earlier.

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/302c6d33-a8ea-4e8a-b02b-7cff1b3de1c5%40googlegroups.com.

Reply via email to