On Sun, 30 Sep 2018 10:18:25 -0500
robert engels <reng...@ix.netcom.com> wrote:

> Yes, it is a very similar if not the same issue, 
> since the type switch must be at the TOP LEVEL

No, in my CGG `for type switch` contract does not need to be at top level.
It is proposed in Chris' but still yours:

> you guarantee the entire method will be duplicated multiple times.

is a false statement, the straw man you want Christian (or me) to fight.

> How you continually do not see the problem with this
> I am not sure, but I think it is because you are using trivial methods

How you continually do not see that **every** compile time switch case
code is reusable for **many** user types in the restricted set described
by a contract I am not sure, but I think it is because you are somehow
blinded by "the years of common knowledge" in the c++/java practice;
and lack of Go's thereof.

Fundamental misunderstanding here is that generics you breathe are about
writing code that deals with possibly infinite set of abstract types. 
With all that mess of declarations scattered over many places, type
parameters that need to be dully filled in every place of concrete use;
then wonders of overgeneralized constructs even their author needs
to study cautiously the day after tomorrow.

Mine's (and to some extent Chris') proposal is about writing code that deals
with restricted (by the contract) set of concrete types and operating on
something that's common to said types. Had you seen that, you would know
that each "case:" is just a contract for some subset.


> Here is a fairly simple generic method from TreeMap.java

I do not discuss java nor I fight straw men built upon it on Go focused list.

CGG (https://github.com/ohir/gonerics) is not about extending Java. 
It is about giving elegant solution to current problem of code repetition
within Go1 real projects. Call it generics or not, it is.

Anyway, this is a Christian Surlykke's proposal thread, so please discuss
**his** proposal here, not CGG. I just warned Christian, and other readers,
about straw man I wasted some time fighting it on CGG threads - in hope that
he will not waste his.

-- 
Wojciech S. Czarnecki
 << ^oo^ >> OHIR-RIPE

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