Re: [go-nuts] build go in Intellij

2018-12-11 Thread robert engels
ber 5, 2018 at 1:42:01 AM UTC+1, robert engels wrote: > I also get errors like: > > > > even though the strings package shows a being imported correctly. > >> On Dec 4, 2018, at 6:37 PM, robert engels > wrote: >> >> Hi, anyone on the list know how, or can poin

Re: [go-nuts] Re: pass interface

2018-12-10 Thread Robert Engels
e that would help here would be what is >>> it >>> that you are actually trying to achieve. >>> >>>> On Mon, 2018-12-10 at 08:53 -0600, Mark Volkmann wrote: >>>> >>>> Yes, this is what I'm trying to do! >>&g

Re: [go-nuts] Pause failures, GC, & StopTheWorld

2018-12-11 Thread robert engels
You might want to review this https://github.com/golang/go/issues/10958 > On Dec 11, 2018, at 10:16 PM, robert engels wrote: > > Reviewing the code, the 5s of cpu time is technically the stop-the-world > (STW) sweep termination > > So, I think the cause of your proble

Re: [go-nuts] Pause failures, GC, & StopTheWorld

2018-12-11 Thread robert engels
. > On Dec 11, 2018, at 9:43 PM, robert engels wrote: > > Well, your pause is clearly related to the GC - the first phase, the mark, is > 5s in #17. Are you certain you don’t have an incorrect highly recursive loop > that is causing the stack marking to take a really long time… ? >

Re: [go-nuts] tools for testing transport over flakey networks

2018-12-11 Thread robert engels
That looks very good, and easy to use, but as I described, it won’t test the TCP flow control behavior due to dropped packets - it can inject delays, etc. but not drop IP datagrams. At the end of the day though, if you configure the delays correctly and randomly, you can simulate the most real

Re: [go-nuts] Pause failures, GC, & StopTheWorld

2018-12-11 Thread robert engels
40566+16+0.035 ms clock, 40566+6.8/15/10+0.035 ms cpu, > 23->24->18 MB, 24 MB goal, 4 P > > I've attached a file that also includes the schedtrace=1000, health check log > messages, key app logs, and the runtime.MemStats collected at the end of the > same run. > > T

Re: [go-nuts] Pause failures, GC, & StopTheWorld

2018-12-11 Thread robert engels
Btw, I only am guessing large stacks because the memory in use is not that great or expanding, and the CPU time is massive - meaning walking lots of stack or root objects. > On Dec 11, 2018, at 9:43 PM, robert engels wrote: > > Well, your pause is clearly related to the GC - the fi

Re: [go-nuts] go assembly question

2018-12-14 Thread robert engels
lay intel syntax. > > Quoting robert engels (2018-12-14 16:41:39) >> but the operands are backwards according to MOVQ on Intel, it >> should be >> dst,src >> SO, I'm thinking "intermediate code", so different syntax. Fine, but >> then when I u

Re: [go-nuts] go assembly question

2018-12-14 Thread robert engels
The tools all emit AT/amd syntax by default and you can use -M intel to get the intel format. The confusing thing is that they don’t use the ‘register prefixes’, so it looks like intel but it is backwards. Oh well. > On Dec 14, 2018, at 3:41 PM, robert engels wrote: > > In the go

[go-nuts] Go assembly interface calls

2018-12-14 Thread robert engels
Are there any examples of a hand-written assembly function that accepts an interface and then makes calls on the interface methods? In reviewing the documentation, it seems impossible, as the PCDATA, and FUNCDATA are not documented, and thus, I think the GC scanner ends up barfing when these

Re: [go-nuts] Pause failures, GC, & StopTheWorld

2018-12-14 Thread robert engels
Usually if it is hung doing an allocation, that means that the STW cannot complete, which means some go routine is in a tight loop no yielding to the scheduler. The only other possibility (I would think) is if you placed a cap on the memory size of the process, and it is trying to allocate but

Re: [go-nuts] Re: Go assembly interface calls

2018-12-15 Thread Robert Engels
the performance. If I hardcore the constant than any change to the interface breaks the assembly code, but I guess that’s the same for struct parameters and parameter order in general. > On Dec 15, 2018, at 8:12 AM, Jason E. Aten wrote: > >> On Saturday, December 15, 2018 at 1:29:14 AM U

[go-nuts] go assembly question

2018-12-14 Thread robert engels
In the go assembly docs, for example: 64-bit Intel 386 (a.k.a. amd64) The two architectures behave largely the same at the assembler level. Assembly code to access the m and gpointers on the 64-bit version is the same as on the 32-bit 386, except it uses MOVQ rather than MOVL: get_tls(CX)

Re: [go-nuts] performance optimization

2018-12-19 Thread robert engels
Isn’t doesn’t even need to be that complex, the following uses 1.25 cores at 100% on my machine: package main import "time" func main() { counter := 0 for { counter++ time.Sleep(time.Microsecond) } } even if you change it to 100 usecs, which is only 10,000 times a second,

Re: [go-nuts] pointer dereference optimization in loops

2018-11-30 Thread robert engels
tal += *p > } > > but I wouldn’t bet on it in > > for … { > total += *p > foo() > } > > //jb > >> On 30 Nov 2018, at 19:01, robert engels > <mailto:reng...@ix.netcom.com>> wrote: >> >> I would think the compiler would be

Re: [go-nuts] pointer dereference optimization in loops

2018-11-30 Thread robert engels
I would think the compiler would be free to optimize this as a single load outside the loop - as Go has no volatile declaration (to inform the compiler that some other thread might of changed the value of *p) > On Nov 30, 2018, at 11:58 AM, robert engels wrote: > > It’s as simple as:

Re: [go-nuts] [ANN] fixed point math library

2018-11-29 Thread robert engels
schak wrote: > > In the majority of cases compression does not reduce the number of bits > of information (appreciably). > > On Thu, 2018-11-29 at 08:35 -0600, Robert Engels wrote: >> And since you like lingo, more bits of information is not always a >> good thing. That’s why we hav

Re: [go-nuts] [ANN] fixed point math library

2018-11-29 Thread Robert Engels
2 = $(10) > var m3 = £(2) > > m1 + m2 // ok > m2 + m3 // compile time error > m1*m2 // compile time error > m1*5 // ok > m1+5 // compile time error > > I doubt go2 will get generics flexible enough for this! > ] > >> On Nov 28, 2018, at 10:47 PM, robert

[go-nuts] [ANN] fixed point math library

2018-11-28 Thread robert engels
For those interesting in financial apps, I have released ‘fixed' at https://github.com/robaho/fixed a high performance fixed-point math library primarily designed for to work with currencies. The benchmarks: (Decimal is the shopspring library, big Int/Float

Re: [go-nuts] Scaling websockets

2018-11-30 Thread Robert Engels
It is not a websocket issue it is a design issue. Either the notification service needs to subscribe to the MQ channel for each user logged into that service, or it needs to subscribe for a group of users, or all users. Sounds like you are doing all users, and it is not working but you don’t

Re: [go-nuts] pointer dereference optimization in loops

2018-11-30 Thread robert engels
It’s as simple as: var count = 1 var p = func X() { total :=0 for i:=0; i <100;i++ { total = total + *p } } no ? > On Nov 30, 2018, at 11:48 AM, Mark Volkmann wrote: > > I think I failed to come up with a good code example. But suppose I need to > do something with a pointer

Re: [go-nuts] pointer dereference optimization in loops

2018-11-30 Thread robert engels
o maybe it’s optimized in >> >> for … { >> total += *p >> } >> >> but I wouldn’t bet on it in >> >> for … { >> total += *p >> foo() >> } >> >> //jb >> >> On 30 Nov 2018, at 19:01, robert engels wrote: >> >>

Re: [go-nuts] [ANN] fixed point math library

2018-11-29 Thread robert engels
dd additional information; fixed.Number. > > Thanks for playing! > > On Thu, 2018-11-29 at 16:24 -0600, robert engels wrote: >> Right and since fixed.Fixed can be reduced to Fixed with no loss of >> information, it is a great lossless compression - more than 50 %. >> &

Re: [go-nuts] [ANN] fixed point math library

2018-11-29 Thread robert engels
Would you elaborate? I’ve read the discussion multiple times, and can’t see what other bits you think he is referring to. > On Nov 29, 2018, at 3:07 PM, Jan Mercl <0xj...@gmail.com> wrote: > > > On Thu, Nov 29, 2018 at 10:02 PM robert engels <mailto:reng...@ix.netcom.co

Re: [go-nuts] [ANN] fixed point math library

2018-11-29 Thread robert engels
, 0x1. > > On Thu, 2018-11-29 at 22:07 +0100, Jan Mercl wrote: >> On Thu, Nov 29, 2018 at 10:02 PM robert engels >> >> wrote: >> >>> >>> I’m pretty sure that is not correct, see >> https://www.maximumcompression.com >>> >>

Re: [go-nuts] Package Stutter

2018-12-01 Thread Robert Engels
suspecting it’s because people’s packages are too large in scope so they end importing tons of external packages. It’s a structure problem not a language feature problem. > On Dec 1, 2018, at 11:08 PM, Ian Denhardt wrote: > > Quoting Robert Engels (2018-12-01 22:25:06) > >> The wa

Re: [go-nuts] Package Stutter

2018-12-01 Thread Robert Engels
common short name for channel > variables. Since we typically use the short name ctx, we also considered the > type name context.Ctx, but this seemed too arbitrary. We went with > context.Context because it's clear and doesn't introduce any unnecessary > confusion. > S >> On Sa

Re: [go-nuts] Package Stutter

2018-12-01 Thread robert engels
I was thinking the similarly, which is why I thought about the List case. In Java, however you get there, it is just referred to as List In Go, it is going to be list.List And in a competing implementation it is going to be container.List or whatever package the author came up with. That’s a

Re: [go-nuts] Package Stutter

2018-12-01 Thread robert engels
wouldn’t refer to it at com.google.common.collect.ImmutableList, you would import it, and use ImmutableList. Which brings me back to why the ‘stutter’ is useful - it allows dot imports to work, without it they cannot. > On Dec 2, 2018, at 12:04 AM, robert engels wrote: > > The .* doe

Re: [go-nuts] Package Stutter

2018-12-01 Thread robert engels
I think it is especially problematic for python because: import * + type inference + dynamic language = hell in my book. > On Dec 2, 2018, at 12:26 AM, Ian Denhardt wrote: > > Quoting robert engels (2018-12-02 00:59:31) > >> Granted, their package structure seems

Re: [go-nuts] Package Stutter

2018-12-01 Thread robert engels
import is used for constants, although for some types of routines it is used to make the code read like a DSL. > On Dec 2, 2018, at 12:04 AM, robert engels wrote: > > The .* doesn’t mean what you think it does - that just means all of the > classes in the package. It is no di

Re: [go-nuts] Package Stutter

2018-12-01 Thread robert engels
list = Collections.singletonList(someobject) otherwise you need to write the code as: java.util.List list = java.util.Collections.singletonList(someobject); > On Dec 1, 2018, at 11:51 PM, Ian Denhardt wrote: > > Quoting Robert Engels (2018-12-02 00:19:40) >> I know everyone

Re: [go-nuts] Package Stutter

2018-12-01 Thread robert engels
y shouldn’t be used - but I making a blanket statement its bad seems like overreach. > On Dec 1, 2018, at 11:19 PM, Robert Engels wrote: > > I know everyone hates it when I reference java but it has had dot imports at > the package level since day one. I won’t repeat why that matte

Re: [go-nuts] Koazee vs Go-Linq vs Go-Funk

2018-12-04 Thread Robert Engels
Shouldn’t this code be index = index+ 2 for index := 0; index < (len/2)+1; index++ { output[index], output[len-1-index] = input[len-1-index], input[index] } And the loop needs to go to Len - you are only copying half the elements > On Dec 4, 2018, at 5:27 AM, Iván Corrales Solera > wrote:

Re: [go-nuts] Koazee vs Go-Linq vs Go-Funk

2018-12-04 Thread Robert Engels
Sorry, I see it is going from both ends... too early :) > On Dec 4, 2018, at 8:33 AM, Robert Engels wrote: > > Shouldn’t this code be index = index+ 2 > > for index := 0; index < (len/2)+1; index++ { > output[index], output[len-1-index] = input[len-1-index], input[inde

Re: [go-nuts] Re: Best way to handle database transactions? (commit, or rollback on error)

2018-12-03 Thread Robert Engels
Go vet will report this as a problem. > On Dec 3, 2018, at 5:54 PM, Ben Hoyt wrote: > > Robert, here is code (actual working code this time) similar to what we have: > https://play.golang.org/p/jUPqgnk6Ttk > > Leonel, yep, I understand that, which is why we have this problem. The thing >

Re: [go-nuts] navigating through interface calls

2018-12-07 Thread Robert Engels
IntelliJ has “show implementations” which will do what you want. > On Dec 7, 2018, at 11:13 AM, Burak Serdar wrote: > > On Fri, Dec 7, 2018 at 9:53 AM David Wahlstedt > wrote: >> >> Hi, >> I am still quite inexperienced in go programming, and I find it quite >> frustrating, sometimes, to

Re: [go-nuts] Package Stutter

2018-12-02 Thread Robert Engels
then in your next post you say that they're > mainly used for constants, "although for some types of routines it is > used to make the code read like a DSL." > > > >> On Sun, 2018-12-02 at 00:04 -0600, robert engels wrote: >> When you use >>

Re: [go-nuts] Package Stutter

2018-12-03 Thread Robert Engels
is noise. Everyone working on the application knows that Employee means model.Employee. It is part of the language (dsl in a way) for that application. > On Dec 3, 2018, at 5:31 AM, Bakul Shah wrote: > >> On Dec 2, 2018, at 11:39 PM, robert engels wrote: >> >>

Re: [go-nuts] Package Stutter

2018-12-03 Thread Robert Engels
I thought the main was special cased, since the app band is based on the directory not the package. > On Dec 3, 2018, at 3:04 AM, roger peppe wrote: > > On Mon, 3 Dec 2018 at 07:40, robert engels wrote: > > Roger, > > > > I experimented with the import n

Re: [go-nuts] Package Stutter

2018-12-03 Thread Robert Engels
Anyway, thanks all for the input. I am continuing to review other large code based for real world examples for what works and what doesn’t and having the input of the community makes understanding the conventions easier. > On Dec 3, 2018, at 10:08 AM, Robert Engels wrote: > > I u

Re: [go-nuts] Package Stutter

2018-12-03 Thread Robert Engels
is qualified. You have a similar problem if both applications have a model package. Now you need to override the import on one of them. No difference IMO. > On Dec 3, 2018, at 10:03 AM, Bakul Shah wrote: > >> On Dec 3, 2018, at 6:52 AM, Robert Engels wrote: >>

Re: [go-nuts] Package Stutter

2018-12-03 Thread Robert Engels
gt; On Dec 3, 2018, at 8:08 AM, Robert Engels wrote: >> >> I understand that, and when working in code that uses both types, which is >> probably limited, you fully qualify. This is pretty standard stuff in the >> enterprise world, as well architected solutions are segment

Re: [go-nuts] Package Stutter

2018-12-02 Thread Robert Engels
decisions. > On Dec 2, 2018, at 10:56 PM, Ian Lance Taylor wrote: > >> On Sat, Dec 1, 2018 at 7:25 PM Robert Engels wrote: >> >> The way to fix it though it just to use dot imports, and encourage it! The >> only time dot imports don’t work is when there isn’t p

Re: [go-nuts] [ANN] fixed point math library

2018-12-01 Thread Robert Engels
use-cases, and other kinds of supporting information so that the >> conversation moves from "i feel that" ==> "in these situations" ==> "a >> workable resolution" ==> ... ==> "X seems the best way forward after much >> analysis." That made go gr

Re: [go-nuts] pass interface

2018-12-09 Thread Robert Engels
Just declare the parameter as type Type and then in the method check if it is an interface. The caller uses the interface type. > On Dec 9, 2018, at 2:43 PM, Jan Mercl <0xj...@gmail.com> wrote: > > On Sun, Dec 9, 2018 at 9:23 PM Mark Volkmann > wrote: > > > Is it possible to pass an

Re: [go-nuts] Re: pass interface

2018-12-09 Thread Robert Engels
I mean reflect.Type not a type that is an interface. > On Dec 9, 2018, at 6:53 PM, Space A. wrote: > > Of course. When you "pass a value whose type implements the interface" as an > interface argument to a function, you in fact pass an interface. > > > воскресенье, 9 декабря 2018 г.,

Re: [go-nuts] [ANN] fixed point math library

2018-11-29 Thread Robert Engels
:20 AM, Jan Mercl <0xj...@gmail.com> wrote: > > On Thu, Nov 29, 2018 at 3:07 PM Robert Engels wrote: > > > Wait, you support type inference and not dot imports... I think you should > > revisit this opinion... > > I believe it's the other way around. Seeing

Re: [go-nuts] [ANN] fixed point math library

2018-11-29 Thread Robert Engels
That being said, I am not sure why I can use the qualified package name when I have a dot import. This would be helpful for method collision like New() > On Nov 29, 2018, at 8:35 AM, Robert Engels wrote: > > I am not referring to variable declarations I am referring to > >

Re: [go-nuts] [ANN] fixed point math library

2018-11-29 Thread Robert Engels
Thanks for the feedback. My comments below. > - To me type name 'fixed.Fixed' sounds like Javaism. Go code usually tries to > avoid such stutter: 'sort.Interface', 'big.Int' etc. > To me that’s a limitation of Go with small packages like this that only have a single public struct. It is based

Re: [go-nuts] [ANN] fixed point math library

2018-11-29 Thread Robert Engels
Also, the most important reason against the setters - a Fixed is immutable. > On Nov 29, 2018, at 7:00 AM, Robert Engels wrote: > > Thanks for the feedback. My comments below. > >> - To me type name 'fixed.Fixed' sounds like Javaism. Go code usually tries >&g

Re: [go-nuts] [ANN] fixed point math library

2018-11-29 Thread Robert Engels
lt;0xj...@gmail.com> wrote: > > On Thu, Nov 29, 2018 at 2:00 PM Robert Engels wrote: > > > >> - To me type name 'fixed.Fixed' sounds like Javaism. Go code usually tries > >> to avoid such stutter: 'sort.Interface', 'big.Int' etc. > > To me that’s a limitation

Re: [go-nuts] [ANN] fixed point math library

2018-11-29 Thread Robert Engels
or files and constants. I think the scaled ctor is a fine addition though. > On Nov 29, 2018, at 7:56 AM, Jan Mercl <0xj...@gmail.com> wrote: > > On Thu, Nov 29, 2018 at 2:41 PM Robert Engels wrote: > > > > Ah, you want a ctor that is the int value. Ok. The Raw doesn’t do

Re: [go-nuts] [ANN] fixed point math library

2018-11-29 Thread Robert Engels
Can't see a way to create from an integer (other than convert to float) >> - Personally I'd rather not see a NewS() which can silently fail with no >> info, I'd prefer to rename NewSErr to Parse and remove NewS. >> >> Other than that, pretty cool. >> >> Che

Re: [go-nuts] [ANN] fixed point math library

2018-11-29 Thread Robert Engels
Technically, a NaN in comparison with any other including NaN is false. For Cmp this creates a problem > On Nov 29, 2018, at 7:41 AM, Robert Engels wrote: > > Ah, you want a ctor that is the int value. Ok. The Raw doesn’t do this > anyway... I could add a NewI() ctor but

Re: [go-nuts] [ANN] fixed point math library

2018-11-29 Thread Robert Engels
NaN. > I think it would be more consistent if fixed.Cmp() would return NaN if any of > it's operands are NaN. > > just my 2ct > messju > > >> On Thu, Nov 29, 2018 at 12:47:05AM -0600, robert engels wrote: >> For those interesting in financial apps, I have released

Re: [go-nuts] [ANN] fixed point math library

2018-11-29 Thread Robert Engels
Btw, thus includes == when using NaN and float64. It’s strange but that’s the way it’s defined. > On Nov 29, 2018, at 7:46 AM, Robert Engels wrote: > > Technically, a NaN in comparison with any other including NaN is false. For > Cmp this creates a problem > >> On

Re: [go-nuts] GORM, saving values

2018-11-29 Thread Robert Engels
If gorm is like json marshalling the fields need to be exported, that is capitalized. Just a thought. > On Nov 29, 2018, at 12:02 AM, mmbarighz...@gmail.com wrote: > > New to Go - please bear with me. > > I am trying to create a new row in my table, but the values are being saved > as

[go-nuts] build go in Intellij

2018-12-04 Thread robert engels
Hi, anyone on the list know how, or can point me to documentation, on building Go itself in Intellij? By that I mean, I want to make changes to the standard lib, or tools (specifically trace), and just compile that tool, tests, etc, work in Intellij. Right now, when I fork golang/go and open

Re: [go-nuts] build go in Intellij

2018-12-04 Thread robert engels
I also get errors like: even though the strings package shows a being imported correctly. > On Dec 4, 2018, at 6:37 PM, robert engels wrote: > > Hi, anyone on the list know how, or can point me to documentation, on > building Go itself in Intellij? > > By that I me

Re: [go-nuts] [ANN] fixed point math library

2018-12-01 Thread Robert Engels
hash.Function? Then you need print.Function. So soon enough there will be a 1000 interfaces named Function that have nothing to do with hashing or printing because everything can be decomposed that way. context.Frame? Now you’re just being silly. You might as well use context.Instance or even

Re: [go-nuts] [ANN] fixed point math library

2018-12-01 Thread Robert Engels
fruit that should be corrected in Go 2 that should be easily agreed upon. > On Dec 1, 2018, at 6:53 AM, Robert Engels wrote: > > hash.Function? Then you need print.Function. So soon enough there will be a > 1000 interfaces named Function that have nothing to do with hashing or

Re: [go-nuts] [ANN] fixed point math library

2018-12-01 Thread Robert Engels
compatibility. > On Dec 1, 2018, at 7:04 AM, Robert Engels wrote: > > And while we’re at it, take a closer look at the hash package > https://golang.org/pkg/hash/#Hash > > Especially the example and the doc surrounding it. > > Why doesn’t Hash “extend” the binary marshall

[go-nuts] Package Stutter

2018-12-01 Thread Robert Engels
In another thread, it has been brought up that things like time.Time are no good. But this format is pervasive. Even newer packages like context.Context. It seems to have been this way for a long time. It there some reasoned paper on why this is now so frowned upon? -- You received this

Re: [go-nuts] [ANN] fixed point math library

2018-12-01 Thread Robert Engels
This is a problem with it seems more than a few in this community. Someone makes a criticism of an idea, backs it up, and is treated in a childish manner because it doesn’t go along with dominate opinions of the controllers of the group think. Not good IMO. > On Dec 1, 2018, at 7:48 AM, Jan

Re: [go-nuts] [ANN] fixed point math library

2018-12-01 Thread Robert Engels
c 1, 2018, at 8:00 AM, Robert Engels wrote: > > This is a problem with it seems more than a few in this community. Someone > makes a criticism of an idea, backs it up, and is treated in a childish > manner because it doesn’t go along with dominate opinions of the controllers >

Re: [go-nuts] Best way to handle database transactions? (commit, or rollback on error)

2018-12-03 Thread Robert Engels
of trying to modify the code snippet from > our actual code on the fly. It was more like: > > t, err := InsertFoo(tx) > > -Ben > > >> On Mon, Dec 3, 2018, 5:50 PM Robert Engels > How can you write this >> >> err := InsertFoo(tx) >> >> Don’

Re: [go-nuts] Package Stutter

2018-12-03 Thread Robert Engels
want to stir the hornets nest at this point, the community has exhausted me a bit... > On Dec 3, 2018, at 3:46 PM, Burak Serdar wrote: > >> On Sun, Dec 2, 2018 at 11:09 PM Robert Engels wrote: >> >> I agree that is an important consideration, but it seems less impor

Re: [go-nuts] Package Stutter

2018-12-03 Thread Robert Engels
Btw, I am working on some issues/proposals/tools that I think will help the situation - not just complaining. > On Dec 3, 2018, at 5:19 PM, Robert Engels wrote: > > Probably another thread unto itself, and some of the issues have already been > corrected like the additio

Re: [go-nuts] Best way to handle database transactions? (commit, or rollback on error)

2018-12-03 Thread Robert Engels
How can you write this err := InsertFoo(tx) Don’t you get no new variables defined error here? > On Dec 3, 2018, at 3:53 PM, Ben Hoyt wrote: > > Hi folks, > > We found some subtle bugs in our db transaction code for handling > commits/rollbacks. Here's the pattern we were using (not real,

Re: [go-nuts] I want to set the position of the window in GUI display of golang

2018-12-04 Thread Robert Engels
You should probably file an issue at http://github.com/lxn/walk They don’t seem to have a community forum, but I think the author could help you easily. Also you could try stack overflow as there are a few questions about this library there. > On Dec 4, 2018, at 7:44 PM, mdi.k...@gmail.com

Re: [go-nuts] Package Stutter

2018-12-01 Thread Robert Engels
line: think of "reduce stutter" as a *best practice* but not a *rule*! > >> On Dec 1, 2018, at 9:53 AM, Robert Engels wrote: >> >> That was my point. The earliest practitioners and language designers used >> the construct extensively but now others clai

Re: [go-nuts] Package Stutter

2018-12-01 Thread Robert Engels
t practitioners. It > doesn't mean the idea does not have merit though. > >> On Sat, 1 Dec 2018, 14:19 Robert Engels, wrote: >> In another thread, it has been brought up that things like time.Time are no >> good. But this format is pervasive. Even newer packages like

Re: [go-nuts] Package Stutter

2018-12-01 Thread Robert Engels
are saying, each case is unique and having a “rule” is too restrictive. Good software design is applying patterns reasonably not as a matter of rules IMO. > On Dec 1, 2018, at 11:57 AM, Ian Lance Taylor wrote: > >> On Sat, Dec 1, 2018 at 9:53 AM Robert Engels wrote: >> &g

Re: [go-nuts] Syntax highlighting (again) [WAS go language sensitive editor?]

2018-11-24 Thread robert engels
To add color, even highly concurrent and parallel designers are easy to read linearly if the constructs support it. > On Nov 24, 2018, at 4:06 PM, robert engels wrote: > > I would argue that good code reads in a linear manner - if it doesn’t it is a > problem with th

Re: [go-nuts] Is conversion between int and uint a no-op i.e. is it free

2018-11-24 Thread robert engels
This maybe true for Go, but not necessarily all languages. It might be implemented as result = original & 0x7FFF (for 32 bit int to uint) it depends on how the language specifies the conversion will occur. That being said, in Go the spec says: For the conversion of non-constant numeric

Re: [go-nuts] Syntax highlighting (again) [WAS go language sensitive editor?]

2018-11-24 Thread robert engels
I would argue that good code reads in a linear manner - if it doesn’t it is a problem with the programmer or the language syntax/grammer. > On Nov 24, 2018, at 3:28 PM, Dan Kortschak > wrote: > > Thanks for bumping this. I had intended to respond. > > There is a fundamental difference

Re: [go-nuts] Syntax highlighting (again) [WAS go language sensitive editor?]

2018-11-24 Thread robert engels
t 4:15 PM, Ian Denhardt wrote: > > Quoting robert engels (2018-11-24 17:06:29) >> I would argue that good code reads in a linear manner - if it doesn’t >> it is a problem with the programmer or the language syntax/grammer. > > I think this is true on a small scale, but...

Re: [go-nuts] Is conversion between int and uint a no-op i.e. is it free

2018-11-24 Thread robert engels
Although by the spec stating - sign extended - they are limiting Go to work on 2’s compliment platforms… > On Nov 24, 2018, at 6:48 PM, robert engels wrote: > > That is only the case if the platform uses 2’s compliment signed numbers - > which is almost certainly the case, but

Re: [go-nuts] Is conversion between int and uint a no-op i.e. is it free

2018-11-24 Thread robert engels
sign extension and no subsequent truncation). > > What happens in other languages is largely irrelevant here (golang- > nuts). > > On Sat, 2018-11-24 at 18:16 -0600, robert engels wrote: >> This maybe true for Go, but not necessarily all languages. It might >> be implemente

Re: [go-nuts] Is conversion between int and uint a no-op i.e. is it free

2018-11-24 Thread robert engels
And as one overly anal person already pointed out - it is complement. > On Nov 24, 2018, at 6:50 PM, robert engels wrote: > > Although by the spec stating - sign extended - they are limiting Go to work > on 2’s compliment platforms… > >> On Nov 24, 2018, at 6

Re: [go-nuts] How to get request url scheme?

2018-11-24 Thread Robert Engels
That should be it... file a bug > On Nov 24, 2018, at 9:21 PM, Anik Hasibul wrote: > > Hi there! > I am working on a web application. And I need to get the scheme of the > request url. > I tried `req.URL.Scheme` it returned empty string. > But my expectation was `http` or `https` > > Any idea

Re: [go-nuts] Syntax highlighting (again) [WAS go language sensitive editor?]

2018-11-24 Thread robert engels
ation/signatures up as you move over the code. > On Nov 24, 2018, at 7:45 PM, Ian Denhardt wrote: > > Quoting robert engels (2018-11-24 17:34:34) >> Agreed, but that is why I have a big problem with variable inference as used >> in Go (and now Java 9 with var). >> &g

Re: [go-nuts] Syntax highlighting (again) [WAS go language sensitive editor?]

2018-11-24 Thread robert engels
structures. > On Nov 24, 2018, at 11:58 PM, Ian Denhardt wrote: > > Quoting robert engels (2018-11-25 00:15:21) > >> Contrast that with this actual code from the leading Go application (picked >> at random): >> >> func (p *pruner) prune(namespa

Re: [go-nuts] How to get request url scheme?

2018-11-25 Thread robert engels
GitHub! > > Here it is: https://github.com/golang/go/issues/28940 > <https://github.com/golang/go/issues/28940> > > Hasibul Hasan (Anik) > > Mobile: +8801902566424 > Email : anikhasi...@outlook.com <mailto:anikhasi...@outlook.com> > Github: @AnikHasibu

Re: [go-nuts] Syntax highlighting (again) [WAS go language sensitive editor?]

2018-11-25 Thread Robert Engels
the review their own python code that they wrote more than 30 days ago... very hard to follow. Btw, the code is part of k8s. > On Nov 25, 2018, at 11:58 AM, Ian Denhardt wrote: > > Quoting robert engels (2018-11-25 01:39:30) >> You kind of made my point, when you state “it’s

Re: [go-nuts] scanner.Text() every other character is null.

2018-11-20 Thread Robert Engels
Your file is probably utf16 so 2 byes for every character. > On Nov 20, 2018, at 1:28 PM, Alex Dvoretskiy wrote: > > > > file, err := os.Open(inputFile) > if err != nil { > log.Fatal(err) > } > defer file.Close() > scanner := bufio.NewScanner(file)

Re: [go-nuts] Re: scanner.Text() every other character is null.

2018-11-20 Thread Robert Engels
You can’t just “change the encoding”. You need to read the strings as utf16. See https://gist.github.com/bradleypeabody/185b1d7ed6c0c2ab6cec > On Nov 20, 2018, at 1:43 PM, Alex Dvoretskiy wrote: > > Yes, it's encoded in UCS-2, UTF-16. > > Should I just change encoding to UTF-8? > > What if I

Re: [go-nuts] google civic api

2018-11-20 Thread robert engels
You need to know the congressional district you were querying, in this case 3, then the parent key is: > ocd-division/country:us/state:wi/cd:3 and the full record > "ocd-division/country:us/state:wi/cd:3": { >"name": "Wisconsin's 3rd congressional district", >"officeIndices": [ >

Re: [go-nuts] Re: go language sensitive editor?

2018-11-20 Thread robert engels
I used both VSCode and Intellij/GoLand. I suggest Intellij/GoLand for anything but trivial projects. The refactoring and navigation tools are far superior to those available in VS code, and it makes working in larger projects with lots of dependencies far easier IMO. > On Nov 20, 2018, at 3:15

Re: [go-nuts] Re: Force pointer at compile time to interface{} parameter

2018-11-19 Thread Robert Engels
have a concept of a "heap"). It's a > type-safety requirement. If you pass in a value, it can't be mutated, > full-stop. Reflect shouldn't allow you to bypass type-safety - only > "unsafe" can do that, hence the name. >> On Mon, Nov 19, 2018 at 9:51 PM Robert Engels w

Re: [go-nuts] Re: Force pointer at compile time to interface{} parameter

2018-11-19 Thread Robert Engels
value is based on the method signature, > which is readily available through the godoc. > >> On Mon, 2018-11-19 at 17:57 -0600, Robert Engels wrote: >> I understand that. I was stating that the syntactic sugar of >> automatic pointer creation to call a method should be removed. Hav

Re: [go-nuts] Re: Force pointer at compile time to interface{} parameter

2018-11-19 Thread Robert Engels
sign the struct to an interface that has the method you are > wanting to call. The following would compile under the rules you're > suggesting. It doesn't. > > https://play.golang.org/p/qRYPaDOPYsl > > >> On Mon, 2018-11-19 at 15:37 -0600, Robert Engels wrote: >> Tha

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

2018-11-27 Thread Robert Engels
loc, > similarly in json where decode_test.go is 1920 sloc and decode.go is > 971. > > Dan > >> On Tue, 2018-11-27 at 21:40 -0600, robert engels wrote: >> If the tests are internal, you technically needs tests for the tests >> - based on LOC there is more

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

2018-11-27 Thread robert engels
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 > <mailto:reng...@ix.netcom.com>> wrote: >> No problem, but just one last word on this… >&

Re: [go-nuts] Re: Force pointer at compile time to interface{} parameter

2018-11-19 Thread Robert Engels
Aren’t all interface references passed as a pointer? It is a var that contains a pointer to the struct and a concrete type of the struct? > On Nov 19, 2018, at 8:45 AM, Volker Dobler wrote: > > > Is there a way to force "SomeFunction" to take pointers only at compile > > time? > > No, sorry.

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

2018-11-26 Thread robert engels
ckage. The tests > <https://github.com/ef-ds/deque>, package-wise, look as they should now. > Thanks Robert for the suggestion. :-) > > On Mon, Nov 26, 2018 at 2:01 PM robert engels <mailto:reng...@ix.netcom.com>> wrote: > It’s funny though, if you look at the c

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

Re: [go-nuts] Re: Force pointer at compile time to interface{} parameter

2018-11-19 Thread Robert Engels
ter, Unmarshal returns an > InvalidUnmarshalError. > >... > > Quoting Robert Engels (2018-11-19 09:57:12) >> Aren't all interface references passed as a pointer? It is a var that >> contains a pointer to the struct and a concrete type of the struct? >> >&

Re: [go-nuts] Re: Force pointer at compile time to interface{} parameter

2018-11-19 Thread Robert Engels
Interesting. I guess that makes sense. But you would think that if using a reflection call should force the compiler to heap allocate , then no reason for the restriction. > On Nov 19, 2018, at 2:33 PM, Ian Denhardt wrote: > > Quoting Robert Engels (2018-11-19 15:13:53) >

<    1   2   3   4   5   6   7   8   9   10   >