[go-nuts] Re: Slice capacity changes

2017-08-08 Thread 18635789436zhjk
I run the code and the two methods output the same results, all 8 在 2017年8月9日星期三 UTC+8上午8:57:07,sno写道: > > Hello, > > I was wondering if someone could help me understand what is going on in > the following piece of code. > > package main > > import ( > "fmt" > "reflect" > "unsafe" > ) > > func

Re: [go-nuts] Can warnings of race detector be ignored and toleranted?

2017-08-08 Thread Dan Kortschak
No. https://software.intel.com/en-us/blogs/2013/01/06/benign-data-races-wha t-could-possibly-go-wrong On Tue, 2017-08-08 at 19:52 -0700, Cholerae Hu wrote: > Some of my colleagues think that, in some cases, such as > approximately  > counting the sum total of requests, we don't need to know the

[go-nuts] Can warnings of race detector be ignored and toleranted?

2017-08-08 Thread Cholerae Hu
Some of my colleagues think that, in some cases, such as approximately counting the sum total of requests, we don't need to know the accurate value, so we can let several goroutines to access one variable without lock or atomic operation to get the highest performance, and we can ignore the

Re: [go-nuts] Slice capacity changes

2017-08-08 Thread sno
Hmm, interesting. However, wouldn't that mean that if I removed the function and did the following: https://play.golang.org/p/enI6UmYoFJ the escape analysis wouldn't happen? On Wednesday, August 9, 2017 at 1:23:15 PM UTC+12, Marvin Renich wrote: > > * sno [170808 20:57]:

Re: [go-nuts] Slice capacity changes

2017-08-08 Thread Marvin Renich
* sno [170808 20:57]: > package main > > import ( > "fmt" > "reflect" > "unsafe" > ) > > func main() { > a := []byte("1234567") > printSliceDetails(a) > } > > func printSliceDetails(a []byte) { > sliceHeader := (*reflect.SliceHeader)(unsafe.Pointer()) >

[go-nuts] Re: Slice capacity changes

2017-08-08 Thread sno
Example at: https://play.golang.org/p/d7HBrbZGo4 -- 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 golang-nuts+unsubscr...@googlegroups.com. For more options,

Re: [go-nuts] [ANN] Edit - Acme command language

2017-08-08 Thread roger peppe
Hang by your pseudopod, write if you find a warm rich planet ripe for conquest. On 8 August 2017 at 22:49, Rob Pike wrote: > Grep for conquest. > > -rob > > > On Wed, Aug 9, 2017 at 6:58 AM, roger peppe wrote: >> On 8 August 2017 at 21:34, Michael Jones

Re: [go-nuts] A humble request/challenge

2017-08-08 Thread Michael Jones
I remember a segmented wheel of Aitkin implementation. Maybe you can start with that. here are a few: https://golanglibs.com/top?q=sieve On Tue, Aug 8, 2017 at 3:31 PM, Pierpaolo Bernardi wrote: > Hello, > > > Here's a link to read and download the paper: > > > >

Re: [go-nuts] A humble request/challenge

2017-08-08 Thread Jan Mercl
On Wed, Aug 9, 2017 at 12:32 AM Pierpaolo Bernardi wrote: > Downloading the paper requires a scribd account which costs money(*). > Is the paper available for free somewhere else? My 2-minute skimming smells quite crackpot-ish

Re: [go-nuts] A humble request/challenge

2017-08-08 Thread Pierpaolo Bernardi
Hello, > Here's a link to read and download the paper: > > https://www.scribd.com/doc/228155369/The-Segmented-Sieve-of-Zakiya-SSoZ Downloading the paper requires a scribd account which costs money(*). Is the paper available for free somewhere else? (*) Or one can use the free month they offer,

Re: [go-nuts] [ANN] Edit - Acme command language

2017-08-08 Thread Rob Pike
Grep for conquest. -rob On Wed, Aug 9, 2017 at 6:58 AM, roger peppe wrote: > On 8 August 2017 at 21:34, Michael Jones wrote: >> The Four Horsemen of the Apocalypse, surely! It would be tempting fate to >> shade them or step on their brand. > > Ah,

[go-nuts] A humble request/challenge

2017-08-08 Thread Jabari Zakiya
Hi I primarly use Ruby for math/science problems/projects because it's so easy to program in, and it allows me to think about how to solve problems without worrying about how to code it. I've also played around with Crystal (aka Ruby on steroids) but it's still young, and doesn't let me

Re: [go-nuts] Re: [Blog] Context should go away for Go 2

2017-08-08 Thread Sam Whited
On Mon, Aug 7, 2017, at 11:33, Uli Kunitz wrote: > I assume here that the proposal is not to change io.Reader but to … There is no proposal. This was briefly discussed in the contributors summit, but the underlying issues are not necessarily well understood. Blog posts like this one help us all

Re: [go-nuts] [ANN] Edit - Acme command language

2017-08-08 Thread roger peppe
On 8 August 2017 at 21:34, Michael Jones wrote: > The Four Horsemen of the Apocalypse, surely! It would be tempting fate to > shade them or step on their brand. Ah, but of which apocalypse? -- You received this message because you are subscribed to the Google Groups

Re: [go-nuts] [ANN] Edit - Acme command language

2017-08-08 Thread Michael Jones
The Four Horsemen of the Apocalypse, surely! It would be tempting fate to shade them or step on their brand. On Tue, Aug 8, 2017 at 5:54 AM, wrote: > Thanks for suggesting the Reader(q0, q1 int64) io.RuneReader. I > accidentally replied off list. > > I wasn't aware of up to

[go-nuts] How to setup go-swagger for an existing project to generate API docs

2017-08-08 Thread Dayana Mallasserry
Has anyone set up swagger for an existing golang project ? -- 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 golang-nuts+unsubscr...@googlegroups.com. For more

[go-nuts] Re: [Blog] Context should go away for Go 2

2017-08-08 Thread Piero de Salvia
I agree with Dave Cheney and Michal Strba that Context should not be used for storage of any kind and only serve the purpose of cancelation. In effect, the original purpose of Context, I think, was avoiding cascading failure in chains of *network* calls, where the result of one call would be

[go-nuts] chaining contexts, best practices question

2017-08-08 Thread Josh Humphries
I noticed the Go doc for context.Context includes the following snippet: Do not store Contexts inside a struct type; instead, pass a Context > explicitly to each function that needs it. I think one potential reason for going against this advice is maintaining context chain relationships in

Re: [go-nuts] Re: [Blog] Context should go away for Go 2

2017-08-08 Thread Daniel Theophanes
I'm personally reasonably happy with Context as-is. Bit if you are looking for a better solution, I completly agree with "as.utf8": the solution won't be found in TLS/GLS (goroutine local storage) but in some other contextual/namespace/arena type thing that is larger then a single goroutine, is

Re: [go-nuts] Re: Go 1.9 Release Candidate 2 is released

2017-08-08 Thread Ian Lance Taylor
On Mon, Aug 7, 2017 at 10:38 PM, ifreelance Asia wrote: > > Will there be any Performance Improvement for RegEx in Golang - It is one of > the most hyped and relevant issue. No particular improvements are expected. Let's take any discussion of this to a separate

Re: [go-nuts] [ANN] Edit - Acme command language

2017-08-08 Thread as . utf8
Thanks for suggesting the Reader(q0, q1 int64) io.RuneReader. I accidentally replied off list. I wasn't aware of up to four horsemen being involved. The man pages didn't prepare me for this. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To

[go-nuts] Re: Go 1.9 Release Candidate 2 is released

2017-08-08 Thread ifreelance Asia
Will there be any *Performance Improvement for RegEx in Golang* - It is one of the most hyped and relevant issue. One of the reference : https://benchmarksgame.alioth.debian.org/u64q/compare.php?lang=go=node ( Regex-redux ) and more -- You received this message because you are subscribed to

[go-nuts] How to secure variables in memory?

2017-08-08 Thread Awn Umar
Seems like this is what you're looking for: Project page: https://github.com/awnumar/memguard Explanation: https://cryptolosophy.io/memory-security-go/ -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop

Re: [go-nuts] "find" for Slices like "append"

2017-08-08 Thread roger peppe
On 8 August 2017 at 08:15, wrote: > >> The Go philosophy is explicitly *not* to give you everything you want. >> It *is* to give you everything you need to build everything you want, >> like Lego. >> > > Yeah right, when men still where real men and programmed

Re: [go-nuts] Re: Generics are overrated.

2017-08-08 Thread Jan Mercl
On Tue, Aug 8, 2017 at 1:37 PM Haddock wrote: > Currently Java developers would not change to Go. Never enough of good news. -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop

[go-nuts] Re: Go channels overused and hyped?

2017-08-08 Thread Dave Cheney
Channels are always going to be more expensive than using a lock if all your doing is timing the cost of the lock vs a channel; aka hello world of channels. Channels are there to send values between goroutines representing work to do, in which case that work has to be significantly more than

[go-nuts] Re: Generics are overrated.

2017-08-08 Thread Haddock
In my opinion generics added to Go would make Go really take off. Currently Java developers would not change to Go. With Go having generics this would change and more people would consider Go also when not coming from Java/C#/etc. -- You received this message because you are subscribed to the

[go-nuts] Re: Go channels overused and hyped?

2017-08-08 Thread Haddock
CSP style concurrency in Go is the killer feature in Go. It makes concurrent programming so much easier. To understand this you need to have done some years of concurrent programming using asynchronous calls, threads, locks, semaphores and all that stuff. I have done that and I can say that

Re: [go-nuts] [ANN] Edit - Acme command language

2017-08-08 Thread roger peppe
On 8 August 2017 at 12:04, Rob Pike wrote: > When I wrote that (1985?), I was misinformed about the Four Horsemen. Which particular Four Horsemen would those be? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe

Re: [go-nuts] [ANN] Edit - Acme command language

2017-08-08 Thread Rob Pike
When I wrote that (1985?), I was misinformed about the Four Horsemen. Also now "u-" is redo. -rob On Tue, Aug 8, 2017 at 8:59 PM, roger peppe wrote: > It's nice to see this, but it would be nicer still if it > was amenable to representations that weren't > just a slice of

Re: [go-nuts] Re: Go channels overused and hyped?

2017-08-08 Thread Konstantin Khomoutov
On Tue, Aug 08, 2017 at 03:39:42AM -0700, snmed wrote: > > There are trade-offs. > > > > Channels are easy to use for simple things, but complicated for complected > > things. > > > > Locking data-structures can easily introduce data-races (see The Little > > Book of Semaphores

Re: [go-nuts] [ANN] Edit - Acme command language

2017-08-08 Thread roger peppe
It's nice to see this, but it would be nicer still if it was amenable to representations that weren't just a slice of bytes (for example disk or network backed files, or just something which made insertions not O(n)). It seems like it might be possible to use Regexp.FindReader* to avoid

[go-nuts] Re: Go channels overused and hyped?

2017-08-08 Thread snmed
Hi Dave Thank you for your comment, I will read your talk on my way back home later and I'm sure i get some better insight in go concurrency. But his argument about better performance of mutex over channels is still valid, maybe you have covered that in your talk, i will see later. Cheers

[go-nuts] Re: Go channels overused and hyped?

2017-08-08 Thread snmed
Hi Egon Thank you for your reply, I myself used channel as a semaphore, i'm not sure if that is a appropriate use case for channels. Anyhow your opionion is very welcome Am Dienstag, 8. August 2017 09:26:35 UTC+2 schrieb Egon: > > There are trade-offs. > > Channels are easy to use for simple

[go-nuts] Re: Go channels overused and hyped?

2017-08-08 Thread as . utf8
Author did a range over channel without select, making cancellation impossible without closing the channel or the process. However, author challenges user to solve cancellation problems with no selection, even saying he awaits for the user to accomplish this. So author will stop waiting when

Re: [go-nuts] "find" for Slices like "append"

2017-08-08 Thread Christoph Berger
May I ask why you turned to Go in the first place? Your taunting remarks seem to indicate that you were forced moving to Go; but on the other hand, earlier you indicated that you need to sell Go (or rather, the lack of a feature in Go) to your team, so it seems you are the driving force behind

Re: [go-nuts] [CGO] how to pass a 2d slice to C?

2017-08-08 Thread jianzhangbjz
Awesome! Thanks again for your kindly help. :) And I updated the code, it works! 在 2017年8月8日星期二 UTC+8下午3:51:10,Konstantin Khomoutov写道: > > On Mon, Aug 07, 2017 at 08:20:01PM -0700, jianzh...@gmail.com > wrote: > > [...] > > > > > > golevelmatrix := [][]int{{1}, {3, 3}, {3, 3, 2}} > > >

[go-nuts] [ANN] Edit - Acme command language

2017-08-08 Thread as . utf8
I'm sure this has been done already, but I thought I'd share my implementation of this here for anyone interested in using structural regular expressions in Go. It doesn't cover 100% of what Edit does in Acme, but its close enough that I can use the example program

Re: [go-nuts] "find" for Slices like "append"

2017-08-08 Thread Jan Mercl
On Tue, Aug 8, 2017 at 9:06 AM wrote: > Sort.Search is nice, but then the list has to be sorted. Then it's a simple for range loop. > So why not come up with > > func findFirst(slice interface{}, matches func(i int ) bool

[go-nuts] Go channels overused and hyped?

2017-08-08 Thread Dave Cheney
Everyone overused channels and goroutines at first. Why wouldn't you? That's why you probably decided to try Go in the first place. I have a talk in Singapore a few months ago trying to explore this idea. It sort of went in a different direction, but the conclusion might be interesting for

Re: [go-nuts] [CGO] how to pass a 2d slice to C?

2017-08-08 Thread Konstantin Khomoutov
On Mon, Aug 07, 2017 at 08:20:01PM -0700, jianzhang...@gmail.com wrote: [...] > > > > > golevelmatrix := [][]int{{1}, {3, 3}, {3, 3, 2}} > > > > >levelmatrix := make([][]C.int, len(golevelmatrix)) > > > > >for i, _ := range golevelmatrix { > > > > >levelmatrix[i] =

[go-nuts] Re: Go channels overused and hyped?

2017-08-08 Thread Egon
There are trade-offs. Channels are easy to use for simple things, but complicated for complected things. Locking data-structures can easily introduce data-races (see The Little Book of Semaphores http://greenteapress.com/wp/semaphores/). The Game/Player example looks weird to me; there's one

Re: [go-nuts] "find" for Slices like "append"

2017-08-08 Thread martin . rode
> > > The Go philosophy is explicitly *not* to give you everything you want. > It *is* to give you everything you need to build everything you want, > like Lego. > Yeah right, when men still where real men and programmed their own device drivers... Or take a car, give me parts & tools and I

Re: [go-nuts] "find" for Slices like "append"

2017-08-08 Thread martin . rode
Sort.Search is nice, but then the list has to be sorted. Wasnt there a lenghty discussion on how awkward sorting is compared to other languages, and then in 1.8. finally someone implemented func Slice(slice interface{}, less func(i, j int ) bool

[go-nuts] Go channels overused and hyped?

2017-08-08 Thread snmed
Hi Gophers I stumbled over a nice and very interesting Blog entry "Go channels are bad and you should feel bad " , I would like to hear some opinions about that article from seasoned go developers. Because I