[go-nuts] Re: I don't know about callbacks in Golang

2018-05-13 Thread Eduardo Moseis Fuentes
thanks it was useful > > > > -- 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

Re: [go-nuts] Re: I don't know about callbacks in Golang

2018-05-07 Thread matthewjuran
The first approach with a func argument to a func can be synchronous (which is what I was thinking at the time) or it could be asynchronous by using the go keyword on the callback. Matt On Monday, May 7, 2018 at 11:48:20 AM UTC-5, florent giraud wrote: > > ok matthew so what you propose is

Re: [go-nuts] Re: I don't know about callbacks in Golang

2018-05-07 Thread florent giraud
ok matthew so what you propose is sync method callback right ? 2018-05-07 17:24 GMT+02:00 : > Corrected mistake: > > func SignalsCallback(arg1 int, arg2 string, callback chan<- struct{}) > > SignalsCallback will only write to callback, not read. > > Matt > > On Monday,

[go-nuts] Re: I don't know about callbacks in Golang

2018-05-07 Thread matthewjuran
Corrected mistake: func SignalsCallback(arg1 int, arg2 string, callback chan<- struct{}) SignalsCallback will only write to callback, not read. Matt On Monday, May 7, 2018 at 10:08:27 AM UTC-5, matthe...@gmail.com wrote: > > Callbacks in Go can be done with a func argument to a func, or a

[go-nuts] Re: I don't know about callbacks in Golang

2018-05-07 Thread matthewjuran
Callbacks in Go can be done with a func argument to a func, or a similar effect can be made with channels by triggering a callback action by waiting on a blocking channel in the application. This Wikipedia article describes the pattern:

Re: [go-nuts] Re: I don't know about callbacks in Golang

2018-05-07 Thread florent giraud
Hello louki. Can you give us a little example about what you mean. I don't really understand this sentence for me "don't share state to communicate, communicate to share state." Thanks a lot for all your answears 2018-05-07 9:03 GMT+02:00 Louki Sumirniy : > To

Re: [go-nuts] Re: I don't know about callbacks in Golang

2018-05-07 Thread Linker
Callback let user to handle context Coroutine let runtime to handle context On Mon, May 7, 2018 at 3:03 PM, Louki Sumirniy < louki.sumirniy.stal...@gmail.com> wrote: > To use callbacks in Go you must follow Functional Programming rules about > shared data. In simple terms, you cannot

[go-nuts] Re: I don't know about callbacks in Golang

2018-05-07 Thread Louki Sumirniy
To use callbacks in Go you must follow Functional Programming rules about shared data. In simple terms, you cannot share data. You can pass pointers to shared data structures, and likely will have to but as soon as you start using also goroutines you will end up with race conditions. To solve

[go-nuts] Re: I don't know about callbacks in Golang

2018-05-07 Thread Sokolov Yura
There is semantic difference between callback passed for continuation of asynchronous action, and closure/function passed as algorithm parameter. sort.Slice and sync.Map.Range both accepts function/closure as algorithm parameter, not as callback. -- You received this message because you are

[go-nuts] Re: I don't know about callbacks in Golang

2018-05-06 Thread Juliusz Chroboczek
> Callbacks are rarely used in Go's ecosystem. https://golang.org/pkg/sort/#Slice https://golang.org/pkg/sync/#Map.Range -- 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

[go-nuts] Re: I don't know about callbacks in Golang

2018-05-04 Thread Krzysztof Kowalczyk
You can read Essential Go (https://www.programming-books.io/essential/go/) On Friday, May 4, 2018 at 5:53:13 PM UTC-7, Eduardo Moseis Fuentes wrote: > > HI everyone I´m Eduardo from Guatemala and I'm beginer. I'm interesting > in all scope golang in fact I was download a little book about it,