Re: [go-nuts] Need advice on AST formatting

2019-10-26 Thread Marvin Renich
* Denis Cheremisov [191026 06:09]: > The answer was simple: > > var fset token.FileSet – wrong > > fset := token.NewFileSet() – right I believe I am in the minority here, but I am not a singleton minority. There are at least several of us who agree that «var» should be used over «:=» whenever

Re: [go-nuts] Re: Slices, backing array, goroutines, perhaps Considerations for Go2

2019-10-26 Thread Gert
On Saturday, October 26, 2019 at 10:22:42 PM UTC+2, atd...@gmail.com wrote: > > > On Saturday, October 26, 2019 at 9:47:39 PM UTC+2, Ian Lance Taylor wrote: >> >> On Sat, Oct 26, 2019 at 10:50 AM atd...@gmail.com >> wrote: >> > >> > I get that we can do that but it's not strictly about slices o

Re: [go-nuts] Re: Slices, backing array, goroutines, perhaps Considerations for Go2

2019-10-26 Thread atd...@gmail.com
On Saturday, October 26, 2019 at 9:47:39 PM UTC+2, Ian Lance Taylor wrote: > > On Sat, Oct 26, 2019 at 10:50 AM atd...@gmail.com > wrote: > > > > I get that we can do that but it's not strictly about slices operations > such as appending or copying. > > Of course, we could copy slices all th

Re: [go-nuts] Re: Slices, backing array, goroutines, perhaps Considerations for Go2

2019-10-26 Thread Ian Lance Taylor
On Sat, Oct 26, 2019 at 10:50 AM atd...@gmail.com wrote: > > I get that we can do that but it's not strictly about slices operations such > as appending or copying. > Of course, we could copy slices all the time but then there is no benefit in > having them and it is not ergonomic as your exampl

[go-nuts] Re: Slices, backing array, goroutines, perhaps Considerations for Go2

2019-10-26 Thread atd...@gmail.com
To add to this issue, that's a problem that is also related to how type equality is treated in the spec and deep equality. If we have some kind of "snapshot" slices for instance, an equality can be determined for these (with some other things to consider) and for structs with fields that are "s

[go-nuts] Re: Slices, backing array, goroutines, perhaps Considerations for Go2

2019-10-26 Thread atd...@gmail.com
I get that we can do that but it's not strictly about slices operations such as appending or copying. Of course, we could copy slices all the time but then there is no benefit in having them and it is not ergonomic as your example shows, nor does it fit your performance cost requirements. If yo

[go-nuts] Re: Slices, backing array, goroutines, perhaps Considerations for Go2

2019-10-26 Thread Gert
Correct, so basically avoid x := y[i:j] if you actually meant copy https://golang.org/ref/spec#Appending_and_copying_slices var a = [...]int{0, 1, 2, 3, 4, 5, 6, 7} var s = make([]int, 6) var b = make([]byte, 5) n1 := copy(s, a[0:])// n1 == 6, s == []int{0, 1, 2, 3, 4, 5} n2 := copy(s

Re: [go-nuts] Re: [ANN] A BASIC compiler

2019-10-26 Thread JuciÊ Andrade
It could be done, Robert. Then the programs would run in every platform that Go runs, quite a few! On Saturday, October 26, 2019 at 12:34:21 PM UTC-3, Robert Engels wrote: > > Why not generate Go? > > -- You received this message because you are subscribed to the Google Groups "golang-nuts" gr

Re: [go-nuts] Re: [ANN] A BASIC compiler

2019-10-26 Thread Robert Engels
Out of curiosity only. > On Oct 26, 2019, at 10:33 AM, Robert Engels wrote: > >  > Why not generate Go? > >>> On Oct 26, 2019, at 9:40 AM, JuciÊ Andrade wrote: >>> >>  >> Feel free to classify the tool anyway you like, Anca. >> >> I don't buy the distinction between "compiler" and "transp

Re: [go-nuts] Re: [ANN] A BASIC compiler

2019-10-26 Thread Robert Engels
Why not generate Go? > On Oct 26, 2019, at 9:40 AM, JuciÊ Andrade wrote: > >  > Feel free to classify the tool anyway you like, Anca. > > I don't buy the distinction between "compiler" and "transpiler" because it's > the same thing. They read code in some language and generates code in some

Re: [go-nuts] Re: [ANN] A BASIC compiler

2019-10-26 Thread JuciÊ Andrade
Feel free to classify the tool anyway you like, Anca. I don't buy the distinction between "compiler" and "transpiler" because it's the same thing. They read code in some language and generates code in some language. I picked C for output because it is utterly portable and everyone could enjoy

[go-nuts] Re: [ANN] A BASIC compiler

2019-10-26 Thread JuciÊ Andrade
I just edited the project README to clarify this point. This tool generates C code that you submits to the C compiler for your particular platform. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving

Re: [go-nuts] Re: [ANN] A BASIC compiler

2019-10-26 Thread Anca Emanuel
Ah so it is an transpiller: https://en.wikipedia.org/wiki/Source-to-source_compiler On Saturday, October 26, 2019 at 5:03:40 PM UTC+3, Robert Engels wrote: > > Yes. I generates C code from a basic program and you compile the C. > > On Oct 26, 2019, at 8:55 AM, Anca Emanuel > wrote: > >  > Plea

Re: [go-nuts] Re: [ANN] A BASIC compiler

2019-10-26 Thread Robert Engels
Yes. I generates C code from a basic program and you compile the C. > On Oct 26, 2019, at 8:55 AM, Anca Emanuel wrote: > >  > Please explain how it works. > Do you get executables from basic programs ? > > >> On Saturday, October 26, 2019 at 4:40:43 PM UTC+3, JuciÊ Andrade wrote: >> Hi, Anca

[go-nuts] Re: [ANN] A BASIC compiler

2019-10-26 Thread Anca Emanuel
Please explain how it works. Do you get executables from basic programs ? On Saturday, October 26, 2019 at 4:40:43 PM UTC+3, JuciÊ Andrade wrote: > > Hi, Anca. > > The compiler proper doesn't use C code, generated code does, it has > references to some support functions. > Those support function

[go-nuts] Re: [ANN] A BASIC compiler

2019-10-26 Thread JuciÊ Andrade
Hi, Anca. The compiler proper doesn't use C code, generated code does, it has references to some support functions. Those support functions are declared in basiclib.h and defined in basiclib.c . On Saturday, October 26, 2019 at 10:32:24 AM UTC-3, Anca Emanuel wrote: > > Why do you need C in the

[go-nuts] Re: [ANN] A BASIC compiler

2019-10-26 Thread Anca Emanuel
Why do you need C in the source code ? On Saturday, October 26, 2019 at 3:16:40 PM UTC+3, JuciÊ Andrade wrote: > > https://github.com/jucie/basic > > A compiler for BASIC programming language. > > > This tool understands what is in David H. Ahl's own words "the gold > standard of microcomputer BA

[go-nuts] Re: Slices, backing array, goroutines, perhaps Considerations for Go2

2019-10-26 Thread atd...@gmail.com
Hi, Thank you for the response. My issue is not really about append but can be illustrated by this : https://play.golang.org/p/YZlo1mqGDLz On Saturday, October 26, 2019 at 2:27:06 PM UTC+2, Gert wrote: > > Sorry, the performance cost is to high. But you can practice a few > programming habits

[go-nuts] Re: Slices, backing array, goroutines, perhaps Considerations for Go2

2019-10-26 Thread Gert
Sorry, the performance cost is to high. But you can practice a few programming habits that can prevent this, like use x = append(x, y) and never x = append(y, x) Basically we only need a Go proverb bible mentioned in one of Rob Pike's talks and we will be fine :) On Saturday, October 26, 2019 a

Re: [go-nuts] module dependency & testing

2019-10-26 Thread Serhat Sevki Dincer
There is an important distinction: - users of your project / library are interested in hard dependencies of it - developers / testers of your library will actually be using its test dependencies Go modules enforces the first group your test dependencies as hard dependencies, which is not right. 2

[go-nuts] [ANN] A BASIC compiler

2019-10-26 Thread JuciÊ Andrade
https://github.com/jucie/basic A compiler for BASIC programming language. This tool understands what is in David H. Ahl's own words "the gold standard of microcomputer BASICs: MITS Altair 8K BASIC, Rev. 4.0 (ix)." It has been tested against every program from Ahl's bestseller "BASIC Computer

[go-nuts] Re: go vet output

2019-10-26 Thread Gert
Stuck :( I am lost in a jungle of source code looking for `Report` printers On Saturday, October 26, 2019 at 1:33:29 PM UTC+2, Gert wrote: > > A no wait need to go other direction and find all type Pass structs > > pass.Report(Diagnostic{Pos: pos, Message: msg}) > > On Saturday, October 26, 2019

[go-nuts] Slices, backing array, goroutines, perhaps Considerations for Go2

2019-10-26 Thread atd...@gmail.com
Hello, I've just realized that slices were much more delicate to use than initially thought. The main issue is that when slices share the same backing array, it is too easy to inadvertently have an unprotected concurrent Read/Write if one is not careful. That can easily happen for a struct tha

[go-nuts] Re: go vet output

2019-10-26 Thread Gert
A no wait need to go other direction and find all type Pass structs pass.Report(Diagnostic{Pos: pos, Message: msg}) On Saturday, October 26, 2019 at 1:23:40 PM UTC+2, Gert wrote: > > > https://github.com/golang/tools/blob/master/go/analysis/analysis.go#L161-L173 > > Can I assume every output of g

[go-nuts] Re: go vet output

2019-10-26 Thread Gert
https://github.com/golang/tools/blob/master/go/analysis/analysis.go#L161-L173 Can I assume every output of go vet passes through here? So basically need to figure out all the references to this two functions and change the format? On Saturday, October 26, 2019 at 12:59:59 PM UTC+2, Gert wrote:

[go-nuts] go vet output

2019-10-26 Thread Gert
https://github.com/golang/go/issues/24344#issuecomment-546589062 The start of the go vet rabbit hole is this right? https://github.com/golang/go/blob/master/src/cmd/vet/main.go So basically one of does or all of the analyzers is responsible for the print output right? So if i want to fix it i n

Re: [go-nuts] Need advice on AST formatting

2019-10-26 Thread Denis Cheremisov
The answer was simple: var fset token.FileSet – wrong fset := token.NewFileSet() – right вторник, 22 октября 2019 г., 11:20:38 UTC+3 пользователь Michel Levieux написал: > > Hi Denis, > > In a project of my own I encountered the same issue. This program moves a > go project to another locati

[go-nuts] [ANN] chasquid v1.1

2019-10-26 Thread Alberto Bertogli
Hello! chasquid v1.1 has been released. chasquid is an SMTP (email) server with a focus on simplicity, security, and ease of operation. It's written in Go, and is open source under the Apache license 2.0. See https://blitiri.com.ar/p/chasquid/ for more information. The main changes in thi

Re: [go-nuts] JSON encoder does not use custom TextMarshaler for map keys when the map key type is a custom string type

2019-10-26 Thread roger peppe
This is behaving as documented. The docs say "keys of any string type are used directly". The reason for that behaviour is probably to avoid breaking backward compatibility, because historically encoding/json did not recognise TextMarshaler in map keys. You could wrap your type in a struct: t