On Fri, Jan 1, 2021 at 10:25 AM robert engels <reng...@ix.netcom.com> wrote:
>
> To Ian’s point, what if I could declare a map that had the semantics of a 
> concurrent hash map without adding generics? I think something like this 
> gives Go a leg up, rather than just making it “closer to Java” as some 
> complain. Go’s “other containers (i.e. sync.Map)” are very similar to Java 
> pre-generics - and better software engineers wrote wrappers then instead of 
> dealing with interface{}/Object everywhere.

It's an interesting idea, and I've thought about it a lot.  But as far
as I can tell, it's a contradiction in terms.  The goal for
compile-time-type-safe containers is to be able to write the
implementation of a data structure such that the implementation is
independent of the types stored in that data structure.  And that is
the definition of generics: "Generic programming enables the
representation of algorithms and data structures in a generic form,
with concrete elements of the code (such as types) factored out."  We
can talk a lot about how to get there, but once we are there, no
matter what it looks like in the end, we will have implemented
generics.

Ian

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAOyqgcXSganwnS-uKZkv8HcvHNPZd%3DMsVidwmVWAD5_OQ4TU0g%40mail.gmail.com.

Reply via email to