Re: [go-nuts] The most performant deque of all time?

2018-11-27 Thread Robert Engels
The fmt_test.go is a perfect example. It only tests the public API so the tests are extensive. There is a huge difference between logic attempting to verify the internal logic and state, versus tests that exercise the public api extensively. I think I’ve talked the point to death... to each h

Re: [go-nuts] The most performant deque of all time?

2018-11-27 Thread Dan Kortschak
Sometimes the code used in production is more concise or clever in order to be more performant. The testing code then is more verbose in order to do the work in a less efficient but clearer way. This may result in the test code being longer than the tested code. In addition to this there may be man

Re: [go-nuts] The most performant deque of all time?

2018-11-27 Thread robert engels
If the tests are internal, you technically needs tests for the tests - based on LOC there is more logic in the tests to “be correct” than actual lines of code. That is a snowballing problem if you ask me… If the code needs 3x LOC for “internal tests”, its a sign that the actual code is too compl

Re: [go-nuts] Re: different behaviour in return: error is shadowed during return

2018-11-27 Thread Tyler Compton
As you are seeing, Go does not allow you to do a naked return when one of the named return values is being shadowed by another variable. If you take a look at the "Return statements" section in the Go Language Specification [1], it mentions this restriction: > Implementation restriction: A compile

Re: [go-nuts] Re: different behaviour in return: error is shadowed during return

2018-11-27 Thread Burak Serdar
On Tue, Nov 27, 2018 at 8:03 PM hui zhang wrote: > happen in go 1.10.2 1.11.2 > Line 203 defines m3u8List, and uses the already defined err. Line 210 is in a nested scope, defines f and err, which shadows the err in the enclosing scope. Change it to: var f *os.File f, err= os.Open(...) an

[go-nuts] Re: different behaviour in return: error is shadowed during return

2018-11-27 Thread hui zhang
happen in go 1.10.2 1.11.2 在 2018年11月28日星期三 UTC+8上午11:02:47,hui zhang写道: > > ./main.go:212:4: err is shadowed during return > > check code above only line 212 report err > however line 203 and 212 are almost the same case. but did not report err. > -- You received this message because you ar

[go-nuts] different behaviour in return: error is shadowed during return

2018-11-27 Thread hui zhang
./main.go:212:4: err is shadowed during return check code above only line 212 report err however line 203 and 212 are almost the same case. but did not report err. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group a

Re: [go-nuts] The most performant deque of all time?

2018-11-27 Thread Freddy Martinez
Sorry Chris, I haven’t seen the code + tests, I don’t think that having x lines of code and 2x lines for test code is a problem, in fact, if you use TDD this is very common because you’ll have a looot of line code in your tests because this is how TDD works… Why is this an issue ? Again, I haven’

Re: [go-nuts] The most performant deque of all time?

2018-11-27 Thread Christian Petrin
FYI, I have released deque version 1.0.1 . Turns out there was a bug related to spared links. I really appreciate the help, Roger (@rogpeppe), for pointing out and helping fix the bug. On Mon, Nov 26, 2018 at 8:07 PM robert engels wrote: >

[go-nuts] Re: Any NULL CIPHER available in TLS package?

2018-11-27 Thread Localhost shell
Just resending it to catch someones' attention who is aware of a Null Cipher implementation in any go crypto package. On Monday, November 26, 2018 at 12:18:48 PM UTC-8, Localhost shell wrote: > > Hello All, > > Is there a TLS package in go that supports NULL CIPHER in TLS > communication in go?

Re: [go-nuts] gosnip: run small snippets of Go code from the command line

2018-11-27 Thread Michael Ellis
This is convenient and useful. Thanks! On Tuesday, November 27, 2018 at 8:52:26 AM UTC-5, Ben Hoyt wrote: > > Good idea -- done! The goimports way is a bit more advanced and featureful > too. > > I love how all these little tools are basically just wrappers around a > library package which does

Re: [go-nuts] contracts thought experiment: dimension checks

2018-11-27 Thread Bakul Shah
On Nov 26, 2018, at 8:46 PM, Ian Lance Taylor wrote: > > On Mon, Nov 26, 2018 at 5:14 PM Dan Kortschak > wrote: >> >> >> Question: >> >> One of the areas where we do this is in the mat package for matrix >> arithmetic and linear algebra. We use panics in lieue of a compile-time >> type check

Re: [go-nuts] contracts thought experiment: dimension checks

2018-11-27 Thread Marko Ristin-Kaufmann
P.S. given that many functions return a tuple (pointer, error) where the pointer is nil if error is not and vice versa, I actually also doubt the usefulness of the Optional type. On the other hand, that makes behavioral contracts (static or run-time) more relevant. Le mar. 27 nov. 2018 à 18:05, Ma

Re: [go-nuts] contracts thought experiment: dimension checks

2018-11-27 Thread Marko Ristin-Kaufmann
> > What is the zero value of a > non-optional pointer? (If I were doing a clean-slate Go, I'd probably > leave zero-values out, but I'm not). > I haven't really spent much thought about it. I suppose that would also fall in the realm of static or run-time checks of behavioral contracts. > -- Y

Re: [go-nuts] switch fallthrough as continue

2018-11-27 Thread Michael Jones
Absolutely what I was going to say. On Tue, Nov 27, 2018 at 6:32 AM Robert Engels wrote: > Breaks backwards compatibility as the switch may already be in a for loop > and using continue... > > On Nov 26, 2018, at 11:50 PM, Göcs Jëss wrote: > > We might as well reduce a one rarely used keyword >

Re: [go-nuts] contracts thought experiment: dimension checks

2018-11-27 Thread Ian Denhardt
Quoting Marko Ristin-Kaufmann (2018-11-27 10:29:15) > if you could call template hacks really dependent types... You really couldn't, they're entirely different beasts. >I expect most applications to need wider family of behavioral contracts >-- and I doubt that Go would ever support the

Re: [go-nuts] contracts thought experiment: dimension checks

2018-11-27 Thread Marko Ristin-Kaufmann
Hi Ian, I'm actually not in favor of dependent types -- this might have come wrong "over the line". I find them limiting and confusing in practice (but I have limited experience, mostly in C++ if you could call template hacks really dependent types...). I expect most applications to need wider fam

Re: [go-nuts] contracts thought experiment: dimension checks

2018-11-27 Thread Ian Denhardt
Odd that the paper you chose to link to is one specifically addressing a difficulty integrating the ideas with Java's class hierarchies -- while the broader subject may be relevant to Go, I don't think that paper is. Wrt Dan's question of doing static checks, I'll quote the paper: > In principle,

Re: [go-nuts] switch fallthrough as continue

2018-11-27 Thread Robert Engels
Breaks backwards compatibility as the switch may already be in a for loop and using continue... > On Nov 26, 2018, at 11:50 PM, Göcs Jëss wrote: > > We might as well reduce a one rarely used keyword > > continue means recommence or resume after interruption by google > > if a continue trigge

[go-nuts] switch fallthrough as continue

2018-11-27 Thread Göcs Jëss
We might as well reduce a one rarely used keyword continue means recommence or resume after interruption *by google* if a continue triggers, the switch, select, or for loop statement *resumes* another case or condition we could do continues inside switch statements switch 1 {case 1: cont

[go-nuts] Re: Go += Package Versioning

2018-11-27 Thread Göcs Jëss
Is it possible to restrain of having 2 files in my workspace/project while keeping 2 versions of the same repo? On Wednesday, February 21, 2018 at 1:20:54 AM UTC+8, Russ Cox wrote: > > Hi everyone, > > I have a new blog post you might be interested in. > https://research.swtch.com/vgo. > > I'll t

Re: [go-nuts] gosnip: run small snippets of Go code from the command line

2018-11-27 Thread Ben Hoyt
Good idea -- done! The goimports way is a bit more advanced and featureful too. I love how all these little tools are basically just wrappers around a library package which does all the work, so you can reuse them in your own code. -Ben On Sun, Nov 25, 2018 at 8:53 AM Sameer Ajmani wrote: > In

Re: [go-nuts] Does not match go tool version "go1.11.2"

2018-11-27 Thread Freddy Martinez
Thanks Ian It works now Regards = Freddy Martínez García Software Engineer B.S. Computer Science LinkedIn: https://ar.linkedin.com/in/freddy-martinez-garcia-47157259 *“If you give someone a program, you will frustrate them for a day;if you teach the

Re: [go-nuts] contracts thought experiment: dimension checks

2018-11-27 Thread Marko Ristin-Kaufmann
@Dan: P.S. Sorry, I probably should have addressed the email to Tamas Gulacsi. On Tue, 27 Nov 2018 at 10:41, Dan Kortschak > wrote: > >> Yes, this was raised as a possibility by Ian. But this negates a very >> valuable aspect of matrices that I completely failed to consider in >> writing the qu

Re: [go-nuts] contracts thought experiment: dimension checks

2018-11-27 Thread Marko Ristin-Kaufmann
Hi Dan, What you are referring to is called *behavioral types* (see, *e.g., * https://www2.ccs.neu.edu/racket/pubs/fse01-flf.pdf). If you want to go that route, you need (usually arbitrarily complex) behavioral contracts (not to be mistaken with the term type contracts used here) and static checks

[go-nuts] Load balancing based on task memory and cpu requirement

2018-11-27 Thread Vasiliy Tolstov
Hi all. I have bunch of tasks that have predictable memory and cpu usage. I need to run them on some nodes in optimal case - fillup one node by one. Some task not needs to be run on the same node. Does anybody knows package that already provide ability to select nodes with this requirements? -- Y

Re: [go-nuts] contracts thought experiment: dimension checks

2018-11-27 Thread Dan Kortschak
Yes, this was raised as a possibility by Ian. But this negates a very valuable aspect of matrices that I completely failed to consider in writing the question: the issue of submatrices and how these are valuable. On Mon, 2018-11-26 at 20:49 -0800, Tamás Gulácsi wrote: > Just a silly idea: what if

[go-nuts] Re: contracts thought experiment: dimension checks

2018-11-27 Thread Dan Kortschak
Thanks, Ian. On Mon, 2018-11-26 at 20:46 -0800, Ian Lance Taylor wrote: > On Mon, Nov 26, 2018 at 5:14 PM Dan Kortschak > wrote: > > > > > > Background: > > > > As part of the Gonum dev team, I have an interest in using Go for > > scientific computing. This stems from long experience with unsafe