Re: [go-nuts] Pipelining with Go and Generics

2022-08-12 Thread Robert Engels
Maybe there is a language barrier. My statement implied Go was a modern language yet it did not have a streams package - not that it was not a modern language. You seem to be looking for a fight and I’m not sure why. Why don’t you focus on solutions - it’s better for everyone. > On Aug 12, 2

Re: [go-nuts] Pipelining with Go and Generics

2022-08-12 Thread Jan Mercl
On Thu, Aug 11, 2022 at 11:18 PM Robert Engels wrote: > Every modern language with generics or similar has a streams package so > there’s no need to call out Java. For some reason unknown to me you seem to consider Go not being a modern language as it does not have a "streams" package. I don't

Re: [go-nuts] Pipelining with Go and Generics

2022-08-11 Thread K. Alex Mills
I don't think you're missing anything. AFAICT, you're right, a generic Stream [T] interface with generic methods hanging off a struct cannot be supported by the current generics implementation because of the restriction on generic methods. I tried to do similar things by implementing interfaces for

Re: [go-nuts] Pipelining with Go and Generics

2022-08-11 Thread K. Alex Mills
Ah, my apologies, I was wrong. Panicking in the midst of a func passed to one of these pipeline stages most certainly *will not* shut down the entire pipeline and cannot be recovered like I had suggested. Sorry about that. Sincerely, K. Alex Mills On Thu, Aug 11, 2022 at 4:56 PM K. Alex Mills

Re: [go-nuts] Pipelining with Go and Generics

2022-08-11 Thread K. Alex Mills
See the example added in this PR for one way to do error handling with this library without involving panic/recover. One possible drawback to this approach is that it doesn

Re: [go-nuts] Pipelining with Go and Generics

2022-08-11 Thread Robert Engels
Every modern language with generics or similar has a streams package so there’s no need to call out Java. Like I said, you can chain by passing and checking the errors within the streamcontext. > On Aug 11, 2022, at 3:59 PM, Jan Mercl <0xj...@gmail.com> wrote: > >  > > >> On Thu, Aug 11, 2

Re: [go-nuts] Pipelining with Go and Generics

2022-08-11 Thread Jan Mercl
On Thu, Aug 11, 2022, 22:37 Robert Engels wrote: > I don’t think that is relevant. It is very difficult to do chaining with > Go’s error model. > I don't think "Go's error model" is a thing. The language specification does not mention it and I'm not aware of any official Go documentation that sh

Re: [go-nuts] Pipelining with Go and Generics

2022-08-11 Thread burak serdar
On Thu, Aug 11, 2022 at 2:37 PM Robert Engels wrote: > I don’t think that is relevant. It is very difficult to do chaining with > Go’s error model. You can pass a shared context to every node and store the > error in the context and protect against concurrent access. It’s doable but > not easy. >

Re: [go-nuts] Pipelining with Go and Generics

2022-08-11 Thread Robert Engels
To finish, you would pass the same context to the execution group to support parallel streams, etc. It is not a drastic change over Go’s error model but every node needs to handle the context cancellation/error properly. Again not hard - certainly doable. I think in some ways it would be easie

Re: [go-nuts] Pipelining with Go and Generics

2022-08-11 Thread Robert Engels
I don’t think that is relevant. It is very difficult to do chaining with Go’s error model. You can pass a shared context to every node and store the error in the context and protect against concurrent access. It’s doable but not easy. Map/reduce and most functional patterns are easily represent

Re: [go-nuts] Pipelining with Go and Generics

2022-08-11 Thread Jan Mercl
On Thu, Aug 11, 2022, 21:36 Robert Engels wrote: > I’d say it certainly highlights a problem with Go’s error model. > Exceptions would fit nicely here - instead it seems you needed to ignore > all error handling - because chaining is impossible with error returns. > It's okay if someone prefers

Re: [go-nuts] Pipelining with Go and Generics

2022-08-11 Thread K. Alex Mills
Thanks so much for taking a look, and good catch! Error handling is definitely a missing piece in the library at the moment. I'm not sure panic/recover is the direction I'd take it, but I do think it could be made to work. When using this library, the way we're handling errors is by hanging the en

Re: [go-nuts] Pipelining with Go and Generics

2022-08-11 Thread Robert Engels
I’d say it certainly highlights a problem with Go’s error model. Exceptions would fit nicely here - instead it seems you needed to ignore all error handling - because chaining is impossible with error returns. A streams api with panic/recover is needed. > On Aug 11, 2022, at 12:55 PM, K. Alex

[go-nuts] Pipelining with Go and Generics

2022-08-11 Thread K. Alex Mills
Hello Gophers, I recently had an opportunity to try out Go generics on a small pipelines package , along with some of my coworkers. The overall goal of this package is to provide helpers for separating concurrency from the core logic of th