Finally I got some spare hours to dive into go-nerics proposal.

So far it seems to me like a construct __derived__ from the mental sketch of
an easy implementation.  But in its current shape it **DESTROYS** the most
important trait of the language: readability **in place**.

Now Go1 guarantees that what I see is what will execute. The only "remote"
knowledge I _sometimes_ need is the interface declaration. Sometimes, because
for given place at sight I can easily infer interface's shape via methods used
(func) or defined (package).

It will not be as easy with contracts.  With proposed go-nerics to know what
the code I see can or cannot do I need to internalize a contract that not
only might even be in other file but it can **include** other contracts. And
a contract is both 'like a code that might run' and 'it does not need to make
sense because it will not run'. Is this from same dev team who taught me of
wonders of  'no suspicious action at distant place'?

I can cope with this after a few years around Go but I see no way how can I
explain this to the person who learns Go as a first language.  
IMO, go-nerics in proposed shape will exclude Go from CS101 curricula.

I will not dive into the type system theory as I lack academia background
for that, I just will try to formulate "craftsman wishes":

1. I want Go to stay **readable in place**. No magic! No hidden "infers";
the less in __some__ places only.

2. I want generic methods. Really generic **methods** - no need to wrap
anything.

3. None "instantiation". Neither at 'just using' package nor at each call
site. Its compiler's work to do.

Ad 3: I see no merit in requiring call site to "instantiate" anything.
Interfaces somehow work without "implements", so should gonerics.
Then an implementer may start with pkg.Sum(x []int) then switch to goneric
pkg.Sum(x type []IntLike) later without touching already deployed code
(package user's likely).

TL;DR: I just want to be able to write code that do something with vars of
more than one type that is still readable and do not bend my mind over
artificial constructs.

And now I am asking myself how - according to current gonerics proposal - how
the contract might looks like for hypothetical "ac" package given at
https://play.golang.org/p/qkslpdyvhaq ? It can't exist at all.

I will sleep on my wishes now, I want 'em come to life badly.
Let Morpheus do his work.

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