Re: [go-nuts] Reason for "goto jumps over declaration" being disallowed

2023-08-26 Thread Mike Schinkel
Hi Kurtis, > Is the code after the "end" label ever going to be more complicated than a > simple "return err"? If not then I don't see the point of the goto statements. Yes, very often. I could show examples but don't want to trigger bike shedding. If you want to see some I'll be happy to

Re: [go-nuts] Reason for "goto jumps over declaration" being disallowed

2023-08-26 Thread Kurtis Rader
On Sat, Aug 26, 2023 at 6:02 PM Mike Schinkel wrote: > OTOH, in my quest to provide the simplest example I could, I provided an > example that does not expose the use-case I was interested in exploring, > unfortunately. > > Let me instead present some real code from my current project, >

Re: [go-nuts] Re: Best IDE for GO ?

2023-08-26 Thread Robert Solomon
Showing the call stack is a core function of the Delve debugger for Go. See github.com/go-delve/delve/cmd/dlv. Install w/ go install github.com/go-delve/delve/cmd/dlv@latest Once learning how to use delve, then any IDE/editor will work. I believe that both VSCode and Goland use delve's

Re: [go-nuts] Reason for "goto jumps over declaration" being disallowed

2023-08-26 Thread Mike Schinkel
Hi Ian, Thank you for the explanation. That makes perfect sense. OTOH, in my quest to provide the simplest example I could, I provided an example that does not expose the use-case I was interested in exploring, unfortunately. Let me instead present some real code from my current project,

Re: [go-nuts] Reason for "goto jumps over declaration" being disallowed

2023-08-26 Thread Ian Lance Taylor
On Sat, Aug 26, 2023 at 2:11 PM Mike Schinkel wrote: > > Question about disallowing `goto ` jumping over a variable declaration? > > > And please, before bikeshedding opinions about the use of `goto` pro or con — > note that the Go standard library uses `goto` in some places — this question >

Re: [go-nuts] Re: Best IDE for GO ?

2023-08-26 Thread Robert Engels
Sorry that was snotty. Bring back the punch cards to really prove who’s a great developer! > On Aug 26, 2023, at 4:29 PM, Robert Engels wrote: > >  > Or you click on the top stack line in an IDE and then arose down. > > It’s like some people want to go back to horse and buggy “because it

Re: [go-nuts] Re: Best IDE for GO ?

2023-08-26 Thread Robert Engels
Or you click on the top stack line in an IDE and then arose down. It’s like some people want to go back to horse and buggy “because it was better for the environment”. Balancing competing priorities is a great skill to have. > On Aug 26, 2023, at 3:51 PM, Justin Israel wrote: > >  > > >>

[go-nuts] Reason for "goto jumps over declaration" being disallowed

2023-08-26 Thread Mike Schinkel
Hi All, Question about disallowing `goto ` jumping over a variable declaration? And please, before bikeshedding opinions about the use of `goto` pro or con — note that the Go standard library uses `goto` in some places — this question is purely for me to gain better understanding the choices

Re: [go-nuts] Re: Best IDE for GO ?

2023-08-26 Thread Justin Israel
On Sun, Aug 27, 2023 at 12:47 AM Mike Schinkel wrote: > If I understand what you are asking then JetBrains GoLand does. > > I do not know if there is a way to use the keyboard, but it does provides > links you can click when it displays the call stack on panic. > If your keymap configuration

Re: [go-nuts] does gonum insist on row-major?

2023-08-26 Thread 'Dan Kortschak' via golang-nuts
On Sat, 2023-08-26 at 07:28 -0700, Brian Candler wrote: > Could you explain the comment "all of Go is cm"? > https://go.dev/play/p/tDJiSTqsiSC > Sorry, that was a typo, should read "all of Go is rm" (what is there is inconsistent with everything else I wrote). -- You received this message

Re: [go-nuts] Re: wtf

2023-08-26 Thread Aln Kapa
I understand, thanks. On Sat, Aug 26, 2023, 18:47 Brian Candler wrote: > In both cases, the argument inside parenthesis is evaluated at the time > "defer" is executed - as indeed is the value of "p". > > In the first case, you wrote "defer p.close(err)". Since err is nil at > this point, at

Re: [go-nuts] Re: wtf

2023-08-26 Thread Brian Candler
In both cases, the argument inside parenthesis is evaluated at the time "defer" is executed - as indeed is the value of "p". In the first case, you wrote "defer p.close(err)". Since err is nil at this point, at the end of the function body, p.close(nil) is called. In the second case, you

Re: [go-nuts] Re: wtf

2023-08-26 Thread Aln Kapa
Well here is the code that works as I need, what is wrong with the previous one ? https://go.dev/play/p/ZW-GmEP5uqu package main import ( "fmt" ) type process struct { } func (p *process) close(err any) { v, _ := err.(*int) if *v == 1 { fmt.Println("error") } else { fmt.Println("no error") } }

[go-nuts] Re: wtf

2023-08-26 Thread Brian Candler
Any arguments to defer functions are evaluated at the time that the defer is executed. In HandleWTF, defer p.close(err) is called immediately after err is declared with value nil, so nil is what is used. >From the specification : "Each time a "defer"

[go-nuts] wtf

2023-08-26 Thread Aln Kapa
Hi All ! Need some help, what am I doing wrong? https://go.dev/play/p/bBlA-i1CxNO // You can edit this code! // Click here and start typing. package main import ( "errors" "fmt" ) type process struct { } func (p *process) close(err error) { if err != nil { fmt.Println("error") } else {

Re: [go-nuts] does gonum insist on row-major?

2023-08-26 Thread Brian Candler
Could you explain the comment "all of Go is cm"? https://go.dev/play/p/tDJiSTqsiSC On Saturday, 26 August 2023 at 14:02:34 UTC+1 Dan Kortschak wrote: > On Sat, 2023-08-26 at 13:45 +0100, Jason E. Aten wrote: > > ah... there is documentation, it is just buried... > > > >

Re: [go-nuts] does gonum insist on row-major?

2023-08-26 Thread 'Dan Kortschak' via golang-nuts
On Sat, 2023-08-26 at 13:45 +0100, Jason E. Aten wrote: > ah... there is documentation, it is just buried... > > https://pkg.go.dev/gonum.org/v1/gonum/mat#section-readme > > "All matrices are stored in row-major format and users should > consider this when expressing matrix arithmetic to ensure

[go-nuts] Re: does gonum insist on row-major?

2023-08-26 Thread Jan
Not exactly what you asked, but something that you may consider: GoMLX . It's an accelerated ML and Math library that uses XLA --> it just-in-time compiles a computation graph to CPU/GPU (and hopefully soon TPU). It powers

Re: [go-nuts] Re: Best IDE for GO ?

2023-08-26 Thread Jan Mercl
On Sat, Aug 26, 2023 at 2:33 PM Jason E. Aten wrote: > > Is there any IDE that allows you to jump through a stack trace like emacs > does? I think many code editors can do that, for example vim: https://vim.fandom.com/wiki/Open_file_under_cursor -- You received this message because you are

[go-nuts] Re: Best IDE for GO ?

2023-08-26 Thread Mike Schinkel
If I understand what you are asking then JetBrains GoLand does. I do not know if there is a way to use the keyboard, but it does provides links you can click when it displays the call stack on panic. -Mike On Saturday, August 26, 2023 at 8:33:08 AM UTC-4 Jason E. Aten wrote: > Is there any

Re: [go-nuts] does gonum insist on row-major?

2023-08-26 Thread Jason E. Aten
ah... there is documentation, it is just buried... https://pkg.go.dev/gonum.org/v1/gonum/mat#section-readme "All matrices are stored in row-major format and users should consider this when expressing matrix arithmetic to ensure optimal performance." Seems odd not to allow both; since this is

[go-nuts] Re: Would it be possible to make this work in the future?

2023-08-26 Thread Jan
Notice that if you don't assign to `tok`, multiple alternatives in `case` works. But the issue is that in Go there are no "duck typing" for data, only for methods (interfaces). `xml.StartElement` and `xmlEndElement` not being the same type, the assignment ('tok.name.Local = "types"`) won't

[go-nuts] Re: Best IDE for GO ?

2023-08-26 Thread Jason E. Aten
Is there any IDE that allows you to jump through a stack trace like emacs does? e.g. If I have a panic on a run, with two keystrokes I can jump to the origin of the panic, and then their caller, and then the parent caller, and then up to the grandparent on the call stack... instantly. I've

[go-nuts] does gonum insist on row-major?

2023-08-26 Thread Jason E. Aten
I do alot of stats/numerical stuff but I haven't tried gonum until now. Yesterday I went to port a bunch of C code that uses BLAS/LAPACK into Go, and thought I'd try it (Gonum) out. Now the logic is the original code is very hairy, and does delicate operations like a bunch of QR