I do not have an example implemented with generics, but I do have examples 
that could use them. My renderview - https://github.com/TheGrum/renderview 
; in particular this 
file: https://github.com/TheGrum/renderview/blob/master/renderparameter.go 
and my still unpublished audio library, visible in pre-release form in the 
processor.go file in https://github.com/TheGrum/rosarygen could both 
benefit from generics. Both have the pattern of having a struct that has 
multiple elements and a type flag, where only one of the elements will 
actually have a value at a time (though the struct that has that pattern in 
processor is not yet present in the rosarygen code). 

They certainly work, but they abandon compile-time type guarantees, 
dropping down to runtime type-casting. They are also brittle to extension. 
I can extend them, but it means adding cases to type-switches in certain 
bits of code. Someone using them as libraries could not do so very easily, 
or possibly at all.

-- 
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/e2b03a06-51eb-4d32-a03e-c5d7d5f7b8ecn%40googlegroups.com.

Reply via email to