That was my original thought. While later I realized that we still need 
some parameter check in the callee code to satisfy the interface matching 
(the generic version of each function in my proposal). And we need special 
assembler function for dynamic interface cast.

On Monday, June 20, 2016 at 1:34:15 PM UTC-7, andrew...@gmail.com wrote:
>
> 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