Re: [go-nuts] Where is defined what recursive type declarations are allowed?

2021-05-03 Thread Ian Lance Taylor
On Mon, May 3, 2021 at 4:39 PM 'Axel Wagner' via golang-nuts wrote: > > this thread had me wonder again about a spec question that recently came up > which I didn't have an answer to: Where does the spec say, which recursive > type declarations are allowed and which aren't? For example, why is

[go-nuts] Where is defined what recursive type declarations are allowed?

2021-05-03 Thread 'Axel Wagner' via golang-nuts
Hi, this thread had me wonder again about a spec question that recently came up which I didn't have an answer to: Where does the spec say, which recursive type declarations are allowed and which aren't? For example, why is `type T *T` legal,

Re: [go-nuts] Recursive type definition

2021-05-03 Thread 'Axel Wagner' via golang-nuts
I would guess that the compiler, when parsing the type-declaration, first allocates a FuncType struct and then stores a pointer to that allocated struct inside its

Re: [go-nuts] Recursive type definition

2021-05-03 Thread Delta Echo
> Not sure what "handle" means in this case. I want to know how this is implemented. -- 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

Re: [go-nuts] Recursive type definition

2021-05-03 Thread Delta Echo
Rob Pike called it recursive type definition in his talk On Mon, May 3, 2021, 11:00 PM Jan Mercl <0xj...@gmail.com> wrote: > On Mon, May 3, 2021 at 6:44 PM Delta Echo wrote: > > > Hi, Is there any document that explains how recursive type definitions > like > > > > type stateFn func(*Scanner)

Re: [go-nuts] Recursive type definition

2021-05-03 Thread Delta Echo
https://github.com/robpike/ivy/blob/master/scan/scan.go#L67 has it also On Tue, May 4, 2021, 12:11 AM Artur Vianna wrote: > I believe the code is derived from a talk by Rob Pike on Lexers: > > https://talks.golang.org/2011/lex.slide#1 > > On Mon, 3 May 2021, 14:58 Jesper Louis Andersen, < >

Re: [go-nuts] Still "missing" priority or ordered select in go?

2021-05-03 Thread Øyvind Teig
mandag 3. mai 2021 kl. 21:44:49 UTC+2 skrev axel.wa...@googlemail.com: > On Mon, May 3, 2021 at 9:16 PM Øyvind Teig wrote: > >> I don't see where hi and lo are being sent to? >> > > They are being `close`d. Reading from a closed channel immediately > succeeds, yielding the zero value. > I chose

Re: [go-nuts] Still "missing" priority or ordered select in go?

2021-05-03 Thread Robert Engels
Yes, C for instance. It doesn’t print ‘client 2’ because your code is broken. It prints “late arrival” if you remove the sleep. The main program finishes before the go routine runs. > On May 3, 2021, at 2:24 PM, Øyvind Teig wrote: > >> mandag 3. mai 2021 kl. 21:11:48 UTC+2 skrev

Re: [go-nuts] Still "missing" priority or ordered select in go?

2021-05-03 Thread 'Axel Wagner' via golang-nuts
On Mon, May 3, 2021 at 9:16 PM Øyvind Teig wrote: > I don't see where hi and lo are being sent to? > They are being `close`d. Reading from a closed channel immediately succeeds, yielding the zero value. I chose to use `close` because it's a non-blocking way to make a channel readable. You could

Re: [go-nuts] Still "missing" priority or ordered select in go?

2021-05-03 Thread Øyvind Teig
mandag 3. mai 2021 kl. 21:11:48 UTC+2 skrev ren...@ix.netcom.com: > In most “select” implementations a set of “ready” endpoints is returned. > So it is trivial for the reader to prioritize some endpoints over others. > Do you mean in user code in other languages than Go? If so, which ones were

Re: [go-nuts] Still "missing" priority or ordered select in go?

2021-05-03 Thread Øyvind Teig
mandag 3. mai 2021 kl. 20:23:09 UTC+2 skrev axel.wa...@googlemail.com: > On Mon, May 3, 2021 at 6:34 PM Øyvind Teig wrote: > >> meaning that there is not any state where random select is ever used. >>> It is. >>> >> Trouble A: If random select is never used […] >> > > I was unclear: When I

Re: [go-nuts] Still "missing" priority or ordered select in go?

2021-05-03 Thread Robert Engels
In most “select” implementations a set of “ready” endpoints is returned. So it is trivial for the reader to prioritize some endpoints over others. Because of the way Go select works it is more difficult - requiring nested selects - and it is more easily implemented using multiple readers and

Re: [go-nuts] Still "missing" priority or ordered select in go?

2021-05-03 Thread 'Axel Wagner' via golang-nuts
On Mon, May 3, 2021 at 6:34 PM Øyvind Teig wrote: > meaning that there is not any state where random select is ever used. >>> >> It is. >> > Trouble A: If random select is never used […] > I was unclear: When I said "It is", I meant "it is used". Your understanding of what select does is

Re: [go-nuts] Recursive type definition

2021-05-03 Thread Artur Vianna
I believe the code is derived from a talk by Rob Pike on Lexers: https://talks.golang.org/2011/lex.slide#1 On Mon, 3 May 2021, 14:58 Jesper Louis Andersen, < jesper.louis.ander...@gmail.com> wrote: > On Mon, May 3, 2021 at 6:43 PM Delta Echo wrote: > >> >> Hi, Is there any document that

Re: [go-nuts] Recursive type definition

2021-05-03 Thread Jesper Louis Andersen
On Mon, May 3, 2021 at 6:43 PM Delta Echo wrote: > > Hi, Is there any document that explains how recursive type definitions > like > > type stateFn func(*Scanner) stateFn > > are handled in Go? > > Is this a type-level question (roughly boiling down to if the type is equi- or iso-recursive) or

Re: [go-nuts] Recursive type definition

2021-05-03 Thread Jan Mercl
On Mon, May 3, 2021 at 6:44 PM Delta Echo wrote: > Hi, Is there any document that explains how recursive type definitions like > > type stateFn func(*Scanner) stateFn > > are handled in Go? Not sure what "handle" means in this case. The language specs do not mention recursive types, so what

[go-nuts] Recursive type definition

2021-05-03 Thread Delta Echo
Hi, Is there any document that explains how recursive type definitions like type stateFn func(*Scanner) stateFn are handled in Go? -- 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

Re: [go-nuts] Still "missing" priority or ordered select in go?

2021-05-03 Thread Øyvind Teig
søndag 2. mai 2021 kl. 21:42:10 UTC+2 skrev axel.wa...@googlemail.com: > On Sun, May 2, 2021 at 9:23 PM Øyvind Teig wrote: > (Removed clumsy sentence from me. Again: sorry!) Thanks for all this answering, Axel! I have tried to expand on Jan's code ( >>

[go-nuts] derefs in location when doing escape analysis?

2021-05-03 Thread xie cui
https://github.com/golang/go/blob/master/src/cmd/compile/internal/escape/escape.go#L136 this comment show me that the derefs field of type location is using the do something like min path between root to this location, but each call to walk one has different roots, some i don't understand why

Re: [go-nuts] fatal error: out of memory allocating heap arena map.

2021-05-03 Thread Raja Murugan
I see ulimit is not set to unlimited to this processs, caused this error. please close this conversation. On Friday, 30 April 2021 at 22:21:27 UTC+5:30 Ian Lance Taylor wrote: > On Fri, Apr 30, 2021 at 9:25 AM Raja Murugan wrote: > > > > fatal error: out of memory allocating heap arena

[go-nuts] Re: How to merge two Unstructured objects type ?

2021-05-03 Thread Brian Candler
On Sunday, 2 May 2021 at 19:18:43 UTC+1 mmahmo...@gmail.com wrote: > > https://pkg.go.dev/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured#section-documentation > > I am looking for something like the following > func mergeObjects(obj1 *uns.Unstructured, obj2 *uns.Unstructured) >

Re: [go-nuts] Still "missing" priority or ordered select in go?

2021-05-03 Thread 'Axel Wagner' via golang-nuts
No worries, I was not upset :) But I did misunderstand you, thanks for clearing that up. On Sun, May 2, 2021 at 11:56 PM Øyvind Teig wrote: > Axel, I was saying (at least *meaning*) that it was impolite *of me* not > to answer *your* exhaustive comments! The other way around. But I now see >

Re: [go-nuts] How string constants are propagated inside a small func

2021-05-03 Thread 'Valentin Deleplace' via golang-nuts
Thank you all for the insights On Saturday, May 1, 2021 at 1:29:15 PM UTC+2 jesper.lou...@gmail.com wrote: > On Fri, Apr 30, 2021 at 7:51 PM 'Valentin Deleplace' via golang-nuts < > golan...@googlegroups.com> wrote: > >> I don't know exactly what SSA does in the compiler, but I thought it >>