Re: [go-nuts] Re: [Blog] Context should go away for Go 2

2017-08-15 Thread Jesper Louis Andersen
The key point in Go is rather simple: Since goroutines clean up for themselves, and since goroutines are not isolated from each other, memory-wise, you need an explicit cancellation system. And programmers must abide by its rule for the correct operation of the program. Programs communicate over

Re: [go-nuts] Re: [Blog] Context should go away for Go 2

2017-08-14 Thread Sam Vilain
Interesting, Alex - almost identical to my recent proposal , with similar conclusions about a cancellation variable. The main difference is that in my proposal you have to declare it in each scope where you'd use it, which

Re: [go-nuts] Re: [Blog] Context should go away for Go 2

2017-08-14 Thread roger peppe
On 14 August 2017 at 11:37, Axel Wagner wrote: > On Mon, Aug 14, 2017 at 12:10 PM, roger peppe wrote: >> >> Thanks for the blog post. ISTM that you're essentially proposing >> package-scoped thread-local variables. > > > To be clear: I am not proposing anything, really :) I'm just trying to > sep

Re: [go-nuts] Re: [Blog] Context should go away for Go 2

2017-08-14 Thread 'Axel Wagner' via golang-nuts
On Mon, Aug 14, 2017 at 12:10 PM, roger peppe wrote: > Thanks for the blog post. ISTM that you're essentially proposing > package-scoped thread-local variables. To be clear: I am not proposing anything, really :) I'm just trying to separate the different concerns people have about context.Value

Re: [go-nuts] Re: [Blog] Context should go away for Go 2

2017-08-14 Thread roger peppe
On 14 August 2017 at 07:08, 'Axel Wagner' via golang-nuts wrote: > For the general interest: I wrote up my thoughts on this in a lengthy blog > post: > Why context.Value matters and how to improve it > In particular, I sketch a design how context.Value could be made a > language-level feature remo

Re: [go-nuts] Re: [Blog] Context should go away for Go 2

2017-08-13 Thread 'Axel Wagner' via golang-nuts
For the general interest: I wrote up my thoughts on this in a lengthy blog post: Why context.Value matters and how to improve it In particular, I sketch a design how context.Value could be made a language-lev

[go-nuts] Re: [Blog] Context should go away for Go 2

2017-08-11 Thread Sam Vilain
On Monday, 7 August 2017 09:06:23 UTC-7, Daniel Theophanes wrote: > > In the projects I've worked on the switch to Context has been a huge win > all across the board. I think it would be sweet to find an effect way to > make io.Reader take a context (I often want just that, and when I really > n

[go-nuts] Re: [Blog] Context should go away for Go 2

2017-08-09 Thread Lucio
If you treat a timeout as a kind of failure, then context makes more sense. In fact, context deals with unblocking a procedure when this is found necessary. That's really all there is to it. Why it is blocked, when it needs to be unblocked, just confuse the picture. The context narrows the "dam

Re: [go-nuts] Re: [Blog] Context should go away for Go 2

2017-08-08 Thread Sam Whited
On Mon, Aug 7, 2017, at 11:33, Uli Kunitz wrote: > I assume here that the proposal is not to change io.Reader but to … There is no proposal. This was briefly discussed in the contributors summit, but the underlying issues are not necessarily well understood. Blog posts like this one help us all un

[go-nuts] Re: [Blog] Context should go away for Go 2

2017-08-08 Thread Piero de Salvia
I agree with Dave Cheney and Michal Strba that Context should not be used for storage of any kind and only serve the purpose of cancelation. In effect, the original purpose of Context, I think, was avoiding cascading failure in chains of *network* calls, where the result of one call would be u

Re: [go-nuts] Re: [Blog] Context should go away for Go 2

2017-08-08 Thread Daniel Theophanes
I'm personally reasonably happy with Context as-is. Bit if you are looking for a better solution, I completly agree with "as.utf8": the solution won't be found in TLS/GLS (goroutine local storage) but in some other contextual/namespace/arena type thing that is larger then a single goroutine, is sti

Re: [go-nuts] Re: [Blog] Context should go away for Go 2

2017-08-07 Thread as . utf8
Threads are the structural and functional loci of execution on some operating systems, data stored in a box accessible to each thread makes sense when you obey the constraint that the things in that box are to be used for that thread exclusively. Goroutines are different, they function like th

Re: [go-nuts] Re: [Blog] Context should go away for Go 2

2017-08-07 Thread Linker
Hi, Daniel! Do you know Goroutine local storage ? How about replace Context with the Goroutine local storage ? On Tue, Aug 8, 2017 at 12:06 AM, Daniel Theophanes wrote: > Hello Micha, > > I'm not seeing any experiences (project

[go-nuts] Re: [Blog] Context should go away for Go 2

2017-08-07 Thread Uli Kunitz
I assume here that the proposal is not to change io.Reader but to create a new interface, maybe context.Reader. There are lot of uses of io.Reader where the Read operations will not block and therefore no context is necessary. A context.Reader would also require a wrapper function that converts

[go-nuts] Re: [Blog] Context should go away for Go 2

2017-08-07 Thread Daniel Theophanes
Hello Micha, I'm not seeing any experiences (project building/maintaining) you are reporting on. In the projects I've worked on the switch to Context has been a huge win all across the board. I think it would be sweet to find an effect way to make io.Reader take a context (I often want just th