What's generic programming?

 An implementation of overloading for datastructures and function/methods.
The compiler is left in charge of going through the code and specifying 
which types should actually be used.

Go restricts the overloading of function/methods.
So we are left with the specification of new datastructures.

To be fair, unless in very specific cases, datastructures specifically 
created to be safe for concurrent use are not too useful.
The reason being that their content is not deterministic. It is tied to the 
scheduler.
Write-only datastructures are probably the only interesting case that is 
interesting.
I mean, for instance, concurrent writes to a map while no reads occurs.
The only interesting case otherwise would be the concurrent reading/writing 
of an append only datastructure, but that would probably be a very specific 
tuning for speed.

So the only very interesting datastructures that would be remaining are 
datastructures that are fast to read from concurrently (maps are quite fast 
in Go)
Or fast to write to concurrently.

I wonder which kind of datastructures people may want to write.
But I have the impression that what people truly want is being able to 
overload functions. That's complicated. Multiple dispatch may be slow, 
perhaps unresolvable.. there are issues on that side. Besides introducing 
unwarranted implicitness.

The appeal of generics is probably a false appeal.

On Wednesday, June 15, 2016 at 3:04:05 AM UTC+2, xingtao zhao wrote:
>
> Here is my proposal for generic in go: 
> https://docs.google.com/document/d/1nO7D15c2B3eq2kF62C0yUs_UgpkyPL2zHhMAmlq1l98/edit?usp=sharing
>
> Many parts has not been finished, and just initial thoughts. In the 
> proposal, I want to keep back compatibility. And I try to add the 
> orthogonal feature only and keep the language still simple enough. 
>
> Please add your comments on it. Hope it is useful and could inspire some 
> new features in go 2.0
>
> Thanks!
>

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