Polymorphism (for Go 2.0), new fast playground is live

Polymorphism is stuck on several hurdles that could be resolved, everything is in document:


Interesting demos that make use of this prototype are here: https://github.com/go-li/demo

Developer can create their own copy function
how a generic function can operate on arbitrary values via callback
Deduplicate some slice that contains values of any type
Linked list taken straight from C

Document link doesn’t work for me.

Clicking the link does not work for me either. However, copying and pasting the URL works fine.

Copying and pasting the URL doesn’t work for me either. However, copying the text of the link and pasting that works.

Working link.

Now that I read the document, unfortunately there seems to be a fundamental misunderstanding on the part of the author as to what generics actually are in a programming language.

“Generic” is not the same as “untyped” or “typeless”. Adding a C void * pointer to Go would not count as an implementation of generics, and would be a disaster for the safety of the language.

Yes, sorry, I was talking rubbish indeed; I actually meant the “URL as seen in the link text”.

Agree on void* vs generics.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.