The idea: Use decorators ($, or @, or #) to specify that the type is a
generic type.
(Syntax is vaguely follows to * "it is a pointer", so $T becomes a "it is a
generic type")
1. Readability - Immediately visible which type is a generic type.
2. Readability - Less braces. Compare
func (type T) RandomItem(a ...T) T { ... }
becomes
func RandomItem(a ...$T) $T { ... }
3. Ability to use decorated interface name as spec for type constrains
func (type T Comparable) Max(a... T) (result T) {...}
might become
func Max(a... $Comparable) (result $Comparable) {...}
4. It does not prevent usage of type keyword if wanted/needed.
Thanks,
Andrey
PS.
it is a distill of my previous post
https://groups.google.com/forum/#!topic/golang-nuts/Rp3yUUy2nS8, which
asked a different question about "How often do we have to specify type
during invocation", and this idea got a bit lost in it.
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/golang-nuts/32b8046a-0719-43c0-845c-3a3eaffebfcco%40googlegroups.com.