Re: [go-nuts] Proposal to add Index operator methods

2020-10-07 Thread Randall O'Reilly
I think we all agree that Python has some major issues.. :) But the point of Jon's argument which struck me as very compelling is that Go would really need full operator overloading to serve as a serious competitor given the standards to which people have become accustomed. I didn't see in

[go-nuts] Re: Reduced error handling noice

2020-10-07 Thread David Skinner
This looks like something I might have done. However, my preference would be to write a wrapper MustGetParameter receives string field, calls store.GetParameter(field), returns parameter or panics. You may then use defer func() { globalErr = recover()} tenantID, err1 :=

[go-nuts] Re: Should we check to see if G is on a P then decide to spin or sleep on mutex lock

2020-10-07 Thread Uday Kiran Jonnala
I meant "see if G is on an M" On Wednesday, October 7, 2020 at 5:55:45 PM UTC-7 Uday Kiran Jonnala wrote: > Just wondering if we can add additional condition below > > https://golang.org/src/runtime/lock_futex.go > > func lock2(l *mutex) { > gp := getg() 52 > ... > // Try for lock,

[go-nuts] Should we check to see if G is on a P then decide to spin or sleep on mutex lock

2020-10-07 Thread Uday Kiran Jonnala
Just wondering if we can add additional condition below https://golang.org/src/runtime/lock_futex.go func lock2(l *mutex) { gp := getg() 52 ... // Try for lock, rescheduling. for i := 0; i < passive_spin; i++ { We may need to improve this by stubbing the ownership

Re: [go-nuts] Proposal to add Index operator methods

2020-10-07 Thread Raanan Hadar
So we respectfully disagree here, so the best thing I can do is add some quality arguments. I think this is an important discussion that might cement Go as a broad DSL in the sense that it does a lot of things exceptionally well, but this issue will remain a blind spot. I fully understand the

Re: [go-nuts] Proposal to add Index operator methods

2020-10-07 Thread Randall O'Reilly
Jon's points probably sink this proposal. Go is a very different language, and making it less self-consistent to solve some fraction of syntactic readability is almost certainly not going to get over the very high threshold for changing the language. If you're going to switch over to Go,

Re: [go-nuts] Question on the generics proposal and arrays

2020-10-07 Thread Markus Heukelom
On Wed, Oct 7, 2020 at 9:12 PM Howard C. Shaw III wrote: > You said: > >> I was trying around with arrays and generics because slices are more >> complex to reason about than arrays. For example, I introduced bugs into my >> code by not being fully aware of slices overwriting original data when

Re: [go-nuts] Question on the generics proposal and arrays

2020-10-07 Thread Howard C. Shaw III
You said: > I was trying around with arrays and generics because slices are more > complex to reason about than arrays. For example, I introduced bugs into my > code by not being fully aware of slices overwriting original data when you > append to them and the capacity is not set correctly.

[go-nuts] Reduced error handling noice

2020-10-07 Thread Johan Martinsson
Hi, I'm looking for thoughts from some experienced go programmers on a technique to reduce error handling verbosity. The basic idea is to be optimistic over a few instructions, and then combine many errors in to one. This gist and explains the idea (note the absence of if err != nil {} )

Re: [go-nuts] ECDSA signature verification

2020-10-07 Thread Shobhit Srivastava
Yeah the inclination is towards 512 curve only so need to optimise it. Will check out the C library. Thanks On Wed, 7 Oct 2020, 22:22 Marcin Romaszewicz, wrote: > secp256r1 has been hand optimized for performance, the others haven't. > > If performance there matters to you, it's actually

Re: [go-nuts] ECDSA signature verification

2020-10-07 Thread Marcin Romaszewicz
secp256r1 has been hand optimized for performance, the others haven't. If performance there matters to you, it's actually faster to call out to C libraries to verify 384 and 512 bit curves. On Wed, Oct 7, 2020 at 9:27 AM Shobhit Srivastava wrote: > Hi All > > I have tried to do the performance

[go-nuts] ECDSA signature verification

2020-10-07 Thread Shobhit Srivastava
Hi All I have tried to do the performance analysis for different curve in golang and got below output: for secp256r1 I got 28000 Signature verified per second for secp384r1 I got 1600 Signature verified per second for secp521r1 I got 700 Signature verified per second Is there something I

[go-nuts] Capture Outgoing Port for a HTTP Request

2020-10-07 Thread ryan...@gmail.com
Is it possible to capture the outgoing port for a given HTTP request? I'm using a knockoff of ab that I wrote in go to send repeated requests to a given web service. Sometimes we get an error and I want to look at a packet trace of it. The problem is it's really hard to find one failed request

Fwd: [go-nuts] Question on the generics proposal and arrays

2020-10-07 Thread Markus Heukelom
On Tue, Oct 6, 2020 at 7:45 PM Ian Lance Taylor wrote: > On Tue, Oct 6, 2020 at 6:32 AM Markus Heukelom > wrote: > > > > It appears to me the current proposal does not allow you to write a > function that sorts an array of any size: > > > > func SortArray[T comparable](array [??]T, less func(a,

Re: [go-nuts] Can ".." occur in golang source?

2020-10-07 Thread Brian Candler
On Wednesday, 7 October 2020 09:31:55 UTC+1, Ryan Keppel wrote: > > I meant this code: > https://golang.org/src/cmd/compile/internal/syntax/scanner.go#L187 . > That code says: - dot followed by a decimal is a number - dot followed by dot followed by dot is a _DotDotDot (ellipsis) - otherwise,

[go-nuts] Re: zero maps rationale

2020-10-07 Thread Brian Candler
On Wednesday, 7 October 2020 08:05:39 UTC+1, Amnon wrote: > > Go generally ensures that zero values are useful. > > So a zero slice allows us to append to it, without having to do any > special initialization. > > Not exactly. Appending to a slice always creates a *new* slice value: s2 :=

Re: [go-nuts] Can ".." occur in golang source?

2020-10-07 Thread Jesper Louis Andersen
On Wed, Oct 7, 2020 at 10:29 AM Ryan Keppel wrote: > Yes, I mean that code section. I did a quick test and two floats tokenizes > just fine (2..5 tokenizes to "2." and ".5")--it doesn't invoke the > described code. I don't think Go in practice would allow two dot tokens in > a row. Go's parser

Re: [go-nuts] Can ".." occur in golang source?

2020-10-07 Thread Ryan Keppel
I meant this code: https://golang.org/src/cmd/compile/internal/syntax/scanner.go#L187 . On Wednesday, October 7, 2020 at 1:29:24 AM UTC-7 Ryan Keppel wrote: > Yes, I mean that code section. I did a quick test and two floats tokenizes > just fine (2..5 tokenizes to "2." and ".5")--it doesn't

Re: [go-nuts] Can ".." occur in golang source?

2020-10-07 Thread Ryan Keppel
Yes, I mean that code section. I did a quick test and two floats tokenizes just fine (2..5 tokenizes to "2." and ".5")--it doesn't invoke the described code. I don't think Go in practice would allow two dot tokens in a row. Go's parser is very loose ("1 + 10 = 20" isn't a syntax error) and I

Re: [go-nuts] Can ".." occur in golang source?

2020-10-07 Thread Jan Mercl
On Wed, Oct 7, 2020 at 9:23 AM Ryan Keppel wrote: > In the current Golang The name is Go. There's no Golang programming language. > implementation of scanning, there's some extra code to handle ".." in the > source (as two dot tokens). Do you mean this?

[go-nuts] Can ".." occur in golang source?

2020-10-07 Thread Ryan Keppel
In the current Golang implementation of scanning, there's some extra code to handle ".." in the source (as two dot tokens). Would this ever happen in practice? Two floats together? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe

Re: [go-nuts] zero maps rationale

2020-10-07 Thread 'Axel Wagner' via golang-nuts
Hi, this has been discussed many times, e.g. https://groups.google.com/g/golang-nuts/c/5_8E9OblIho/m/b9O038mzBQAJ In short: The semantics of maps require them to be pointer-shaped. Currently, all zero values are a sequence of zero bytes (making it very cheap to initialize to them). That means the

[go-nuts] zero maps rationale

2020-10-07 Thread Amnon
Go generally ensures that zero values are useful. So a zero slice allows us to append to it, without having to do any special initialization. This approach also extends to the standard library. sync.Mutexs are unlocked and usable in the zero state. Even zero sync.Maps ready for use. So why