Overhead at runtime will be not very big;
1. Generate each time an instance of specific generic type with arguments
2. Perform generic specific type checks before any kind of an assignements

1. The first overhead can be reduced (eleminated) by the static code 
generation of specified generic types with storing them in special place

Eg.

foo := Foo<string, int>{}

Since this code is static (which means that at runtime the arguments 
(string and int) remains unchanged then this type (Foo<string, int>) can 
be canonicalized (I can also say "hashed" but canonicalized is more 
precisely). pre-generated by the compiler and stored (to avoid re-creating 
it each time at runtime) for further use.

2. The second overhead can be reduced (eleminated) by the static code 
generation when compiler can compute types (used in assignments).

Since specific generic type is know at compile time then generic type 
checks (the same as regular, non generic) can be performed at compile time

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