Very insightful.

I am relatively new to go, but I would like to make a few observations.

1. When the issue of keyword arguments has come up before, usually someone 
suggests passing a struct as the function argument.  Did you try this?  It 
might be worth mentioning in your analysis, if only to give an example of 
why it wasn't a good match.

2. I notice some potential overlap between a couple of features you 
mention.  The first is map(f,x) for mapping a slice of arbitrary type 
(incidentally it couldn't be called "map" for obvious reasons)  The second 
is using generator functions as ranges.

It occurs to me that if you could initialize a slice from a generator 
function, you'd have another way to achieve your map. The generator 
function could also do filtering, making it more like a comprehension.

3. A generator function would have to maintain its own thread of execution 
independent from the recipient - much like a goroutine.  So this might end 
up looking very similar to a function which stuffs values down a channel, 
which is option 3 in the linked article 
<https://ewencp.org/blog/golang-iterators/index.html>.

The problem with garbage collection needs to be dealt with, which at the 
simplest could be that the receiver closes the channel when done. Today 
this would cause the sender to panic, so that would need to be dealt with - 
perhaps some sort of "soft close".

-- 
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/fdd4882f-0c17-42f2-b301-ab65e5ce08a7%40googlegroups.com.

Reply via email to