On Monday, June 13, 2016 at 1:28:26 PM UTC+2, Sean Russell wrote:
>
> Interesting work.  I understand this is very much a work in progress; how 
> would you (eventually) see the implementation of map(), e.g.:
>
> https://play.golang.org/p/GogrfKf-oA
>

a map() like this should already work
 

> Or is this an accepted limitation of functionality for simplicity, that 
> any single generic scope must have at most a single generic type? 
>

this is 1 parametric polymorphism, developer can have only one "wild card 
type" per generic function. yes it's a kind of limitation but still 
powerful enough.
only thing allowed with the generic variables is to copy or swap them, 
everything else needs to be done using callback arguments. 

2,3, or N-parametric polymorphism would probably be even more powerful. But 
every generic variable (T1) would be still only be copied to other
generic variables parametrized by the same type (T1), copying (*T1 ) to 
(*T2) would not be allowed. But what if the function called with
T1=T2? Suddenly copying across is possible. This would add complexity. 
 

>  Do you forsee any confusion or complexity in overloading "*" further 
> (currently, pointers & math, eventually pointers & math & generics)?
>
> --- SER
>

* is not overloaded. * is simply a generic pointer, e.g. equivalent to C 
void * pointer. Call-site type checking makes it safe.

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