[go-nuts] A new solution of type list in generic.

2020-12-28 Thread redsto...@gmail.com
If generic is inevitable, make it better. The type list in the current draft is so special that it is added only for operators. I think it will bring complexity and inconsistens in go. So I get an idea to replace it. type bigger[T bigger] interface{ BiggerThan(T) bool } func max[T

[go-nuts] Help test arg support in Mage

2020-12-28 Thread Nate Finch
Mage (magefile.org and github.com/magefile/mage) is getting support for arguments in targets and dependencies. I'd love some people running the PR branch through its paces to make sure I haven't missed anything before landing it, since this is kind

Re: [go-nuts] A new solution of type list in generic.

2020-12-28 Thread burak serdar
On Mon, Dec 28, 2020 at 4:30 AM redsto...@gmail.com wrote: > > If generic is inevitable, make it better. The type list in the current draft > is so special that it is added only for operators. I think it will bring > complexity and inconsistens in go. So I get an idea to replace it. There

Re: [go-nuts] A new solution of type list in generic.

2020-12-28 Thread Ian Lance Taylor
On Mon, Dec 28, 2020 at 3:30 AM redsto...@gmail.com wrote: > > If generic is inevitable, make it better. The type list in the current draft > is so special that it is added only for operators. I think it will bring > complexity and inconsistens in go. So I get an idea to replace it. > > type

[go-nuts] Re: Generics, please go away!

2020-12-28 Thread L Godioleskky
" If generics gets added to Go, we're opening a very dangerous door, and it will be the downfall of Go because - and Robert Griesemer this is especially addressed to you - what's next then? Seriously, what's next? ... " .. AI, followed by cryto currency and asexual repoduction On Tuesday,

Re: [go-nuts] Import a submodule from its parent package?

2020-12-28 Thread Aidan
Hello Ian, I dont see why the program would need any more than to block the signal with sigprocmask before calling tcsetpgrp. I am currently testing a patch to do exactly that. So far ive added the sigset_t data type to syscall/types_linux and regenerated ztypes_linux_amd64, and added calls

[go-nuts] Re: Generics - please provide real life problems

2020-12-28 Thread Hein Meling
Here is another example. I haven’t worked out the details yet, but I envision that I can avoid generating this QuorumSpec interface in our Gorums framework: https://github.com/relab/gorums/blob/master/cmd/protoc-gen-gorums/dev/zorums_qspec_gorums.pb.go And instead use generics... I hope that

[go-nuts] Possible language improvement re multiple assignment

2020-12-28 Thread bobj...@gmail.com
For the case of multiple variable assignment where some of the target variables are to be created in the local scope and some are to be found in the existing scope... Allow: existingVar, :newVar = 1, 2 instead of: var newVar int existingVar, newVar = 1, 2 That additional line for

Re: [go-nuts] Possible language improvement re multiple assignment

2020-12-28 Thread Ian Lance Taylor
On Mon, Dec 28, 2020 at 11:40 AM bobj...@gmail.com wrote: > > For the case of multiple variable assignment where some of the target > variables are to be created in the local scope and some are to be found in > the existing scope... > > Allow: > > existingVar, :newVar = 1, 2 > > instead of: >

Re: [go-nuts] Possible language improvement re multiple assignment

2020-12-28 Thread Artur Vianna
The only "disadvantage" i could think would be increasing the ways one could create variables: var i int i := 0 :i = 0 and it allows this madness: :a, b, :c, d, :e = 0, 1, 2, 3, 4 Otherwise i like the idea, but i don't mind using the long version in pro of simplicity. On Mon, 28 Dec 2020,

Re: [go-nuts] A new solution of type list in generic.

2020-12-28 Thread burak serdar
On Mon, Dec 28, 2020 at 7:10 PM redsto...@gmail.com wrote: > > But interface-only contracts do work here, as I suggest, only need to > introduce implicit type conversion. Type list is not so good as you say. > When defining the generic funcition max, I am not expecting number and > string,

[go-nuts] Mage release v1.11.0 - Argument support!

2020-12-28 Thread Nate Finch
Mage v1.11.0 supports taking positional arguments for targets that have arguments of type int, bool, string, or time.Duration. For example, if your magefile contains this target: func Build(what string) { fmt.Printf("building the %s...\n", what) } you can run it by running $ mage build

Re: [go-nuts] A new solution of type list in generic.

2020-12-28 Thread redsto...@gmail.com
But interface-only contracts do work here, as I suggest, only need to introduce implicit type conversion. Type list is not so good as you say. When defining the generic funcition max, I am not expecting number and string, and I am not expecting operator>, I am expecting method BiggerThan.

[go-nuts] json.NewDecoder()/Decode() versus Unmarshal() for single large JSON objects

2020-12-28 Thread Amit Saha
Hi all, let's say I am a single large JSON object that I want to process in my HTTP server backend. I am trying to get my head around if there is any performance advantage - memory or CPU to use the json.NewDecoder()/Decode() mechanism versus the Unmarshal() function? Thanks, Amit -- You

Re: [go-nuts] A new solution of type list in generic.

2020-12-28 Thread Ian Lance Taylor
On Mon, Dec 28, 2020 at 5:14 PM redsto...@gmail.com wrote: > > Constant here is just an example. We can use varaibles. > var a, b int > c := max(a,b) > on the base of type inference. > Predeclared types don't have methods.But we can extend the type restriction, > using implicit type conversion

Re: [go-nuts] json.NewDecoder()/Decode() versus Unmarshal() for single large JSON objects

2020-12-28 Thread burak serdar
On Mon, Dec 28, 2020 at 5:22 PM Amit Saha wrote: > > Hi all, let's say I am a single large JSON object that I want to > process in my HTTP server backend. > > I am trying to get my head around if there is any performance > advantage - memory or CPU to use the json.NewDecoder()/Decode() >

Re: [go-nuts] A new solution of type list in generic.

2020-12-28 Thread redsto...@gmail.com
Constant here is just an example. We can use varaibles. var a, b int c := max(a,b) on the base of type inference. Predeclared types don't have methods.But we can extend the type restriction, using implicit type conversion here, between BiggerInt and int, BiggerFloat and float32. I think the

[go-nuts] Re: json objects

2020-12-28 Thread Amnon
You could try something like this https://play.golang.org/p/a-4i045QdXX On Saturday, 26 December 2020 at 17:49:33 UTC zxj1341...@gmail.com wrote: > In fact, the JSON content you pasted here is NOT valid, cause there > shouldn't be more than one root element in a single JSON file (you can try

Re: [go-nuts] Go and AI Recommendations

2020-12-28 Thread Vitaly
https://www.tensorflow.org/ понедельник, 28 декабря 2020 г. в 11:09:48 UTC+5, meera: > I don't know what resources you have tried already so I'm probably going > to state the obvious. > > You're probably looking for some language agnostic resources on the > subject, since having it be Go

Re: [go-nuts] Go and AI Recommendations

2020-12-28 Thread Vitaly
https://www.tensorflow.org/install/lang_go понедельник, 28 декабря 2020 г. в 15:01:07 UTC+5, Vitaly: > https://www.tensorflow.org/ > > понедельник, 28 декабря 2020 г. в 11:09:48 UTC+5, meera: > >> I don't know what resources you have tried already so I'm probably going >> to state the