Re: [go-nuts] Help to choose the right type of the key for a map.

2023-03-16 Thread Andy Balholm
I would guess that in the case of AST nodes, you're likely more interested in the *identity* of the nodes than their *values*. In that case, you should use the pointers to the nodes as your map keys. If the *values* truly are what you care about, use the go/format package to convert the node ba

[go-nuts] A Go GUI Developer Survey

2022-03-02 Thread Andy Williams
Today a combined group of Fyne and Gio developers have launched a follow up to the Go Developer Survey – the Go GUI Developer Survey . Jus

[go-nuts] Redundant code in reflect package

2022-02-09 Thread Andy
The DeepEqual function has the same judgment as the deepValueEqual function [image: 2022-02-09_232909.png] -- 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 gol

[go-nuts] Re: How to force cgo to use C++ compiler (g++) instead of gcc ?

2021-11-01 Thread Andy Polyakov
Hmm, previous suggestion to use '#cgo CFLAGS: -x c++' doesn't seem to work all the way. [I've only tested class declarations at the time.] Trouble is that '-x c++' is passed even when compiling the glue code, so that even glue symbols get decorated, which doesn't fly with linker at the end. I s

[go-nuts] Re: How to force cgo to use C++ compiler (g++) instead of gcc ?

2021-11-01 Thread Andy Polyakov
> lib.go > -- > package lib > > // #cgo CFLAGS: -x c++ > // #include "cpplib/file.cpp" > // #include "cpplib/wrapper.cpp" > import "C" > Formally, the remaining question is if C compilers on all of your target platforms support -x option. In the worst case, if some does not, you

[go-nuts] [ANN] Pack: Interfaces for LZ77-based data compression

2021-09-20 Thread Andy Balholm
at higher compression levels. But by breaking the problem up into smaller pieces, it makes it much easier to experiment with compression algorithms. Andy -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and s

Re: [go-nuts] Re: fonts, bitmap and the (old TeX) PK file format

2021-09-02 Thread Andy Balholm
You don't need a full PostScript interpreter to use a Type 1 font. They use a very limited subset of PS. To embed one in a PDF, I don't think you need to parse it at all, if you know the metrics and the encoding already. You can just embed it as a binary blob, if I'm not mista

[go-nuts] Tools to extract packages?

2021-07-18 Thread Andy Bursavich
In the Kubernetes ecosystem, I frequently run into a problem where I want to use some custom resource but its API package is in the same module as its controller (and loads of other crap) that have a massive dependency chain (often broken and "fixed" with replace directives). In several instanc

[go-nuts] Re: Module dependency cycles

2021-05-02 Thread Andy Bursavich
On Wednesday, February 24, 2021 at 7:42:24 PM UTC-8 Bryan C. Mills wrote: > That said, that kind of coordinated release is *really* unpleasant, so > this is one of the motivating problems for https://golang.org/issue/36460 > (which I've been actively working on since basically the start of 2020)

Re: [go-nuts] what is asm6 and span6 for?

2021-03-29 Thread Andy Balholm
as well. Andy On 3/29/21 7:45 AM, xie cui wrote: https://github.com/golang/go/blob/master/src/cmd/internal/obj/x86/asm6.go this file named asm6, and there is a func named span6, what is 6 for here? -- You received this message because you are subscribed to the Google Groups "golang-nuts&q

Re: [go-nuts] insane idea to eliminate CGO latency

2021-03-15 Thread Andy Balholm
ndard library for its system calls—because C code compiled with this compiler would not be able to call into the system libc without CGo! Andy On 3/13/21 10:57 PM, Jason E. Aten wrote: I was noodling about how to minimize the cost of crossing the CGO barrier from Go code into C code and back. T

[go-nuts] Re: Module dependency cycles

2021-02-24 Thread Andy Bursavich
To summarize the concrete issue: An old version of Prometheus pulled in k8s.io/client-go@v12.0.0+incompatible . An old version of Alertmanager pulled in that version of Prometheus. An old version of Cortex pulled in that version of Alertmanager. An old version of Thanos pulled in that version of C

[go-nuts] Re: Module dependency cycles

2021-02-24 Thread Andy Bursavich
s/transient/transitive/ -- 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. To view this discussion on the web visit https:

[go-nuts] Module dependency cycles

2021-02-24 Thread Andy Bursavich
I’m trying to get rid of a transient dependency on k8s.io/client-go@v12.0.0+incompatible and I’ve tracked it down to the co-dependency of Thanos and Cortex... Presumably, there isn't a dependency cycle in their packages, but there is in their modules (at different versions). The two update thei

Re: [go-nuts] global http client or defaultclient

2020-11-30 Thread Andy Balholm
I would be surprised if there were any performance differences (unless you configured the client differently), since the only difference is whether you're using a global client that you created or one that the http package created. Andy On 11/30/20 9:58 AM, jun min wrote: I'm mak

Re: [go-nuts] Go is easy to lean. But other languages are hard to forget

2020-10-05 Thread Andy Hall
thankfully I chose to learn go as my first language...so all good then :-) On Monday, October 5, 2020 at 10:23:32 AM UTC+1 era...@gmail.com wrote: > I believe all these are statements of facts based on practical > observations that one finds out that to learn GO one needs to unlearn and > then

Re: [go-nuts] handling database.Query empty set

2020-09-13 Thread Andy Hall
: > sorry Andy, > > it seems i haven't read your example carefully enough. your question was > what to do if the query returns multiple rows. i tried to explain that. > > however the query in your example looks like it will only ever return a > single row, because you pr

Re: [go-nuts] handling database.Query empty set

2020-09-13 Thread Andy Hall
he loop to confirm but I certainly don't get any null pointer connection errors so may just comment this for clarity and leave it. I guess it saves more code ;-) On Saturday, September 12, 2020 at 9:53:28 PM UTC+1 mb0 wrote: > hi Andy, > > when you take a look at the documentation

Re: [go-nuts] writing to net.Conn tcp socket

2020-09-12 Thread Andy Hall
project and go back to the docs as you suggest rather than ploughing through every problem I come across...as fun as that can be. On Saturday, September 12, 2020 at 8:02:31 PM UTC+1 b.ca...@pobox.com wrote: > On Saturday, 12 September 2020 19:36:18 UTC+1, Andy Hall wrote: >> >> to h

[go-nuts] handling database.Query empty set

2020-09-12 Thread Andy Hall
the database.Query func does not return ErrNoRows unlike the database.QueryRow func so how to I handle an empty set when I wish to run a query which returns multiple rows... // tell other players in the room you have entered rows_users, err := database.Query("SELECT username FROM users WHERE roo

Re: [go-nuts] writing to net.Conn tcp socket

2020-09-12 Thread Andy Hall
hen testing the map ? On Sat, 12 Sep 2020 at 18:33, Andy Hall wrote: > > thanks brian...I have looked at sync / channels but I think the > simplicity of mutex should work fine for me. > > On Sat, 12 Sep 2020 at 18:13, Brian Candler wrote: > > > > On Saturday, 1

Re: [go-nuts] writing to net.Conn tcp socket

2020-09-12 Thread Andy Hall
thanks brian...I have looked at sync / channels but I think the simplicity of mutex should work fine for me. On Sat, 12 Sep 2020 at 18:13, Brian Candler wrote: > > On Saturday, 12 September 2020 17:04:19 UTC+1, mb0 wrote: >> >> a global map is the way to go, however writing an reading the map fro

Re: [go-nuts] writing to net.Conn tcp socket

2020-09-12 Thread Andy Hall
wrote: > > Hi Andy, > > a global map is the way to go, however writing an reading the map from > multiple go routines will fail (in your case different handle calls for > connections) because the map data structure is not safe for concurrent use > and must be coordinated. the w

Re: [go-nuts] writing to net.Conn tcp socket

2020-09-12 Thread Andy Hall
OK so I just moved the declaration of the map to the package itself which makes it universal...all working as expected. Thanks. On Saturday, September 12, 2020 at 1:35:49 PM UTC+1 Andy Hall wrote: > So this works fine... > > func handleConnection(c net.Conn) { > // get user detail

Re: [go-nuts] writing to net.Conn tcp socket

2020-09-12 Thread Andy Hall
is outside of a goroutine... On Saturday, September 12, 2020 at 7:55:34 AM UTC+1 Andy Hall wrote: > I think this is exactly what I need to do...thanks very much. I'm looking > forward to implementing it. > > On Saturday, September 12, 2020 at 5:43:09 AM UTC+1 Shulhan wrote: > >

Re: [go-nuts] writing to net.Conn tcp socket

2020-09-11 Thread Andy Hall
I think this is exactly what I need to do...thanks very much. I'm looking forward to implementing it. On Saturday, September 12, 2020 at 5:43:09 AM UTC+1 Shulhan wrote: > > > Pada tanggal Sab, 12 Sep 2020 02.54, Andy Hall > menulis: > >> if I have multiple clients

[go-nuts] writing to net.Conn tcp socket

2020-09-11 Thread Andy Hall
if I have multiple clients connected to a tcp server and I wish to write back to specific connections I can record the net.Conn value and then use the Write method on it...but when using Println I get the following for two clients... &{{0xc94000}} &{{0xc94080}} which when testing with

Re: [go-nuts] what is the complexity of regexp.MustCompile()?

2020-06-11 Thread Andy Balholm
exp/syntax/compile.go> > > Using a singly linked list with a pointer to the tail pointer would give > constant time append > > Ray > > On Thu, Jun 11, 2020 at 5:40 PM Andy Balholm <mailto:andybalh...@gmail.com>> wrote: > Right. That’s why I left the double bar in my

Re: [go-nuts] what is the complexity of regexp.MustCompile()?

2020-06-11 Thread Andy Balholm
list that way is O(n^2). Andy > On Jun 11, 2020, at 4:47 PM, Kurtis Rader wrote: > > On Thu, Jun 11, 2020 at 2:57 PM 'Axel Wagner' via golang-nuts > mailto:golang-nuts@googlegroups.com>> wrote: > The Graph is clearly not linear. Another way to see this is to

Re: [go-nuts] what is the complexity of regexp.MustCompile()?

2020-06-11 Thread Andy Balholm
It’s more than linear. 1 repetitions take 73 times the time of 1000 repetitions. Andy > On Jun 11, 2020, at 2:11 PM, Ray Pereda wrote: > > On my laptop, I compiled Andy's code from here: > https://play.golang.org/p/82UBmyfyqV- <https://play.golang.org/p/82UBmyfyq

Re: [go-nuts] what is the complexity of regexp.MustCompile()?

2020-06-11 Thread Andy Balholm
ime is roughly quadratic in the number of repetitions. Andy > On Jun 11, 2020, at 12:55 PM, Andy Balholm wrote: > > Obviously any reasonable input validation or length limit would disallow it. > > The time requirement is only quadratic, not exponential, so it takes > rid

Re: [go-nuts] what is the complexity of regexp.MustCompile()?

2020-06-11 Thread Andy Balholm
Obviously any reasonable input validation or length limit would disallow it. The time requirement is only quadratic, not exponential, so it takes ridiculously long inputs to cause a problem. Andy > On Jun 11, 2020, at 12:26 PM, Robert Engels wrote: > > Why would you ever allow t

Re: [go-nuts] What Go devs think about issues described by Daniel Lemire in article "The Go compiler needs to be smarter"?

2020-06-04 Thread Andy Balholm
I think by “at compile time” he means at JIT time (when converting bytecode to machine language). Andy > On Jun 4, 2020, at 1:02 PM, Robert Engels wrote: > > The author either doesn’t know Java or had significant editing errors - Java > determines uses the runtime proce

Re: [go-nuts] Type Assertion on File type

2020-05-07 Thread Andy Balholm
The problem is that the function’s return type is already *os.File (rather than io.WriteCloser or some other interface), so the type assertion is pointless. Andy > On May 7, 2020, at 5:09 AM, André kouamé wrote: > > Hi, > > I want to check, if the value return by my functi

Re: [go-nuts] Re: C++ 11 to Golang convertor

2020-04-06 Thread Andy Balholm
paragraphs of documentation explaining what it does and how to use it would really help. Andy > On Apr 6, 2020, at 9:16 AM, Jan Mercl <0xj...@gmail.com> wrote: > > On Mon, Apr 6, 2020 at 6:08 PM Andy Balholm wrote: >> >> In looking back over some of these old conversa

Re: [go-nuts] Re: C++ 11 to Golang convertor

2020-04-06 Thread Andy Balholm
In looking back over some of these old conversations about converting C to Go, I realized that there is some confusion about the different programs named "c2go". There are basically 2: rsc/c2go is the program that was used to convert the Go runtime, compiler, and linker from C to Go. It is not

Re: [go-nuts] [ANN] gopkg.in/goracle.v2 renamed to github.com/godror/godror

2019-12-14 Thread Andy Balholm
They probably do, but only for database-related products, or maybe for software in general. Trademarks are industry-specific. Andy > On Dec 13, 2019, at 9:22 PM, kddavidson...@gmail.com wrote: > > I would be surprised if they have a legal claim to "Ora" as well, othe

[go-nuts] run queue length

2019-12-06 Thread Hochhaus, Andy
Hello, I would like to export the runtime run queue length (as can be seen using "go tool trace") to our monitoring infrastructure but I am unable to find a way to access it using the runtime package without traces enabled. Is the run queue length accessible from application code? -And

Re: [go-nuts] Looking for an app w/ mult. versions of a dependency

2019-12-05 Thread Andy Balholm
I’m pretty sure there is no “otherwise simple” example, because depending on two versions of the same library isn’t usually something a project does deliberately (except as a last resort). It’s normally the consequence of an extremely complex forest of dependencies. Andy > On Dec 5, 2019,

Re: [go-nuts] early close of http.Client's Response.Body

2019-11-25 Thread Andy Balholm
are met. Otherwise Close will close the connection. There is no need to discard a Client after an early Close. A Client is not tied to a single connection. Andy > On Nov 25, 2019, at 11:10 AM, Liam Breck wrote: > > > > On Mon, Nov 25, 2019, 10:32 AM Andy Balholm &

Re: [go-nuts] early close of http.Client's Response.Body

2019-11-25 Thread Andy Balholm
ion 2 for long ones. For consistency, and because we don’t always know the response length in advance (e.g. if it is chunked), it always does option 2. Andy -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group

Re: [go-nuts] ls: unsupported SSLv2 handshake received

2019-09-18 Thread Andy Balholm
successfully negotiate an SSLv3 connection. Of course, now that SSLv3 is deprecated, it’s not very likely that support for these old handshakes will be added. Andy > On Sep 18, 2019, at 1:41 AM, Anthony Martin wrote: > > Prabhash Rathore once said: >> Looking at comment,

Re: [go-nuts] possible to set tls.Config.Servername with http.client.Do

2019-07-15 Thread Andy Balholm
If you leave the Servername blank, http.Transport will get it from the HTTP request. Andy > On Jul 15, 2019, at 12:27 PM, efah...@gmail.com wrote: > > Hi, > > I was wondering how one can do concurrent tls requests with one single > http.Client where all the servers servin

Re: [go-nuts] Announcing gg ("gigi") your new friend

2019-07-04 Thread Andy Balholm
I recently ran across https://github.com/mvdan/gogrep <https://github.com/mvdan/gogrep>. It does some of that. Andy > On Jul 4, 2019, at 5:30 PM, Bakul Shah wrote: > > Very nice! > > A natural great extension[1] would be language aware grep/sed/awk: > - return an e

Re: [go-nuts] In module mode, where does "go install" install executables

2019-06-25 Thread Andy Balholm
Yes, it looks like that is right. Andy > On Jun 25, 2019, at 9:25 AM, Wagner Riffel wrote: > > I'd bet the default GOPATH, that is $HOME/go > BR. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscri

[go-nuts] In module mode, where does "go install" install executables

2019-06-25 Thread Andy Balholm
When GOPATH is set, “go install” installs executables to $GOPATH/bin (assuming there is just one path in GOPATH). When GOPATH is not set, where do the executables go? I haven’t been able to find them. Andy -- You received this message because you are subscribed to the Google Groups "g

Re: [go-nuts] the Dominance of English in Programming Languages

2019-05-18 Thread Andy Balholm
Just be glad that the American date format caters to (or for!) those Americans who say “January two”, not those who (like me) say “January second.” Imagine what date-formatting code would look like if ordinal suffixes were required! (Jan 1st, Jan 2nd, etc.) Andy > On May 18, 2019, at 2:59

Re: [go-nuts] the Dominance of English in Programming Languages

2019-05-17 Thread Andy Balholm
definitely closer to current British English than to American. Andy > On May 17, 2019, at 1:26 PM, Michael Jones wrote: > > I know that you joke here, but I had an interesting dinner conversation in > London last year with erudite, scholarly friends who shared with me that >

Re: [go-nuts] What happens to global vars when main() ends ?

2019-05-03 Thread Andy Balholm
When the program exits, the operating system releases all the memory allocated to it. So the GC doesn’t need to bother with freeing the memory. Andy > On May 3, 2019, at 5:49 PM, Matt Harden wrote: > > On Fri, May 3, 2019, 17:28 mailto:lgod...@gmail.com>> > wrote: > Do

Re: [go-nuts] Is it possible to simplify this snippet?

2019-05-01 Thread Andy Balholm
case rl.KeyW: p.Rect.Y -= 1 case rl.KeyS: p.Rect.Y += 1 } } Andy > On May 1, 2019, at 2:51 PM, Burak Serdar wrote: > > On Wed, May 1, 2019 at 2:31 PM mailto:lgod...@gmail.com>> > wrote: >> >> Great example o

[go-nuts] Re: brotli: my c2go experience

2019-03-23 Thread Andy Balholm
% 45.647576ms 11.8 MB/s gzip-9 30.6% 47.600027ms 11.4 MB/s > On Mar 16, 2019, at 3:55 PM, Andy Balholm wrote: > > Over the last few months, I’ve been working (on and off) at translating the > Brotli compression library into Go. (The result is at > github.com/andybalholm/br

[go-nuts] brotli: my c2go experience

2019-03-16 Thread Andy Balholm
. Andy -- 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, visit https://groups.google.com/d/optout.

Re: [go-nuts] Using "er" and "able" for interfaces

2019-01-18 Thread Andy Balholm
convention. Andy > On Jan 18, 2019, at 9:28 AM, robert engels wrote: > > Yes, the method should be called read() - the debate is if it should be > Reader or Readable. I prefer the able because it says to me, if something > implements Readable, then any methods defined by Read

Re: [go-nuts] C++ 11 to Golang convertor

2019-01-05 Thread Andy Balholm
of the source location that everything corresponds to—and then use that information to guide the translation. Andy -- 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, sen

Re: [go-nuts] C++ 11 to Golang convertor

2019-01-03 Thread Andy Balholm
r than leaving it as manual cleanup. Andy > On Jan 3, 2019, at 3:14 PM, Valentin Vidic wrote: > > On Thu, Jan 03, 2019 at 02:46:39PM -0800, Eric Raymond wrote: >> On the other hand, I believe graceful, comment-preserving C to idiomatic-Go >> transpilation is almost possible.

Re: [go-nuts] C++ 11 to Golang convertor

2019-01-03 Thread Andy Balholm
You don’t use CGo; you just translate all the libraries you depend on as well. :-P But you’re definitely right about pthreads; that would be a nightmare. Andy > On Jan 3, 2019, at 10:01 AM, Robert Engels wrote: > > I am pretty sure the other task is impossible, unless the generated

Re: [go-nuts] C++ 11 to Golang convertor

2019-01-03 Thread Andy Balholm
a license, but I’m planning to use the MIT license. Andy > On Jan 2, 2019, at 8:03 PM, Ian Lance Taylor wrote: > > On Wed, Jan 2, 2019 at 7:37 PM wrote: >> >> I have C++ 11 source files which I need to convert to Go language code >> Is there any converter tool for

Re: [go-nuts] What are the reasonable reasons to use pointers?

2019-01-02 Thread Andy Balholm
And yet Knuth wrote TeX with virtually no pointers, because he didn’t trust the dynamic memory allocators in many Pascal implementations (probably from bitter experience). So he used array indices as s substitute for pointers. Andy > On Jan 2, 2019, at 3:13 AM, Chris FractalBach wr

Re: [go-nuts] What are the reasonable reasons to use pointers?

2019-01-01 Thread Andy Balholm
Some languages, like Java, don’t have explicit pointer types. But they do it by making almost everything an implicit pointer. Andy > On Jan 1, 2019, at 9:13 AM, Jan Mercl <0xj...@gmail.com> wrote: > > > On Tue, Jan 1, 2019 at 12:34 PM 伊藤和也 <mailto:kazya.ito.dr

Re: [go-nuts] Strange behaviour of left shift

2018-12-06 Thread Andy Balholm
sound like the kind of tradeoff that would be accepted in Go. One issue is that the type of the expression would change depending on what CPU the program is being compiled for. I don’t think that happens anywhere else in Go, except when using build tags. Andy > On Dec 6, 2018, at 8:45 AM, Mic

Re: [go-nuts] Strange behaviour of left shift

2018-12-05 Thread Andy Balholm
When an untyped integer constant is converted to a typed value, it always becomes int. I suppose the rules could be made more complicated to handle values that won’t fit in an int. But what if the value is too big to fit in a uint64? Should it be a float64 then? Andy > On Dec 5, 2018, at 8

Re: [go-nuts] Strange behaviour of left shift

2018-12-05 Thread Andy Balholm
Apparently in your code the value is being assigned to an int. But it’s too large for an int; it needs a uint64 to hold it. Andy > On Dec 5, 2018, at 8:35 AM, Michel Levieux wrote: > > Hi guys, > > With a colleague of mine, we've run into a strange issue today. When w

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

2018-11-24 Thread Andy Balholm
program’s performance. Andy > On Nov 24, 2018, at 8:45 AM, Ugorji Nwoke wrote: > > Thanks so much Silviu. I love this tool - I had seen it before, but didn't > realize it also supported go language. Thanks so much for bringing it up - it > should help me do more investigat

Re: [go-nuts] Generics: an unwelcome conclusion and a proposal

2018-11-08 Thread Andy Balholm
I’ve updated my gist at https://gist.github.com/andybalholm/acecba3acf57bf1254142dadce928890 <https://gist.github.com/andybalholm/acecba3acf57bf1254142dadce928890> to use contracts as adaptors. Andy > On Nov 6, 2018, at 8:27 PM, Andy Balholm wrote: > > It is implicit: the fu

Re: [go-nuts] Generics: an unwelcome conclusion and a proposal

2018-11-06 Thread Andy Balholm
It is implicit: the functions defined in the contract are available (in scope) in generic functions that use the contract. I’m thinking about revising how the adaptors work. I might let contracts act as adaptors. But I don’t have time to work on it any more today. Andy > On Nov 5, 2018, a

Re: [go-nuts] Generics: an unwelcome conclusion and a proposal

2018-11-05 Thread Andy Balholm
t) } func (BigIntAdder) Add(a, b *big.Int) *big.Int { return new(big.Int).Add(a, b) } The adaptor is specified along with the type parameters when instantiating a generic function or type: var bigints []*big.Int fmt.Println(SumSlice(*big.Int, BigIntAdder)(bigints)) Andy -- You received this m

Re: [go-nuts] Generics: an unwelcome conclusion and a proposal

2018-11-03 Thread Andy Balholm
ewhat reduce compile-time type safety. Andy -- 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 mor

Re: [go-nuts] Regarding contracts

2018-10-26 Thread Andy Balholm
After giving this some more thought, i’ve changed my syntax for complex relationships between types. Now it looks like this: contract Node { Edges() []Edge } contract Edge { Nodes() (from, to Node) } func ShortestPath(type N Node, E Edge)(src, dst N) []E Andy > On Oct 25, 2

Re: [go-nuts] Regarding contracts

2018-10-25 Thread Andy Balholm
ing the type as a map key as well. So now I just have a built-in contract `comparable`. The only type names that are used in structural contracts are interfaces, and they are used in the same way as in an interface that embeds another interface. So that should limit the cognitive load somewhat. &

Re: [go-nuts] Regarding contracts

2018-10-24 Thread Andy Balholm
{ if a < b { return a } return b } Andy > On Oct 24, 2018, at 9:47 AM, Burak Serdar wrote: > > On Wed, Oct 24, 2018 at 10:22 AM Andy Balholm wrote: >> >> Here’s my attempt at streamlining it, as well as adding a way to deal with

Re: [go-nuts] Regarding contracts

2018-10-24 Thread Andy Balholm
Here’s my attempt at streamlining it, as well as adding a way to deal with the operator/method dichotomy: https://gist.github.com/andybalholm/8165da83c10a48e56590c96542e93ff2 <https://gist.github.com/andybalholm/8165da83c10a48e56590c96542e93ff2> Andy > On Oct 23, 2018, at 9:37

Re: [go-nuts] Avoiding overloading

2018-10-20 Thread Andy Balholm
, powerful idea; it's working out the implications that ties people’s brains in knots. Andy > On Oct 19, 2018, at 9:18 PM, Eric S. Raymond wrote: > > Andy Balholm : >> It seems to me that what you are proposing with “implements” is not really a >> replacement for contra

Re: [go-nuts] Avoiding overloading

2018-10-19 Thread Andy Balholm
function’s body be its own contract. If the function uses <, the types passed to it must support <… Andy > On Oct 19, 2018, at 1:15 PM, Eric S. Raymond wrote: > > Ian Denhardt : >> What would code making use of a `Sortable` type look like? If you can't >> actuall

Re: [go-nuts] Regarding contracts

2018-10-18 Thread Andy Balholm
That would also be a weakness of most of the other proposals, including my own to add operators to interfaces. Contracts are more powerful, at the expense of extra complexity. Andy > On Oct 18, 2018, at 10:34 AM, Ian Lance Taylor wrote: > > On Wed, Oct 17, 2018 at 11:58 AM, Bur

Re: [go-nuts] Regarding contracts

2018-10-18 Thread Andy Balholm
I don’t think that generic functions should have access to private fields of their type parameters, regardless of what package they are in. Andy -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this grou

Re: [go-nuts] Regarding contracts

2018-10-17 Thread Andy Balholm
superior in that regard. But replacing contracts with “like” definitely sounds like something worth investigating. Andy -- 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 i

Re: [go-nuts] Regarding contracts

2018-10-17 Thread Andy Balholm
; b { return a } return b } Andy -- 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

[go-nuts] Operators in interfaces

2018-10-17 Thread Andy Balholm
uld be extended to other operations beyond the arithmetic and comparison operators, perhaps something like this: interface stringish { len [int]byte } Andy -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe

Re: [go-nuts] why does go reverse the order of name and type? "i int" vs "int i"

2018-09-20 Thread Andy Balholm
It made sense to Ken and Dennis back when C’s type system was a lot simpler than it is now, anyway. > On Sep 20, 2018, at 7:40 AM, Michael Jones wrote: > > the other answer is: "for c it made sense to ken and dennis, alas, we are not > them" > > On Thu, Sep 20, 2018 at 1:32 AM Eric S. Raymon

Re: [go-nuts] Announcing a Fyne GUI toolkit

2018-09-17 Thread Andy Williams
Hi, I don’t know if it helps but I wrote a short document about the driver in Fyne. https://github.com/fyne-io/fyne/wiki/Drivers Andrew On 14 September 2018 at 20:01:56, Andrew Williams (handya...@gmail.com) wrote: Hi, Thanks. There is an efl opengl driver which we could utilise instead of the

Re: [go-nuts] [ANN] oksvg and rasterx; SVG 2.0 path compliant renderer and rasterizer

2018-04-25 Thread Andy Balholm
So it sounds like the AGPL is a good license to choose if you want to keep your code from being used by big companies… ;-) > On Apr 25, 2018, at 8:48 AM, 'David Chase' via golang-nuts > wrote: > > > > On Tuesday, April 24, 2018 at 10:45:35 AM UTC-4, matthe...@gmail.com wrote: > I’m curious i

[go-nuts] Tutorial - Code your own Proof of Stake blockchain

2018-03-25 Thread andy
Hi everyone, I just wrote a new tutorial blog post on how you can code your own Proof of Stake blockchain. Let me know if you have any feedback. https://medium.com/@mycoralhealth/code-your-own-proof-of-stake-blockchain-in-go-610cd99aa658 -- You received this message because you are subscribed

[go-nuts] Code your own blockchain mining algorithm in Go

2018-03-04 Thread andy
Hi everyone, I wrote a blog post showing you how to write up your own Proof of Work algorithm in Go. Feedback welcome! https://medium.com/@mycoralhealth/code-your-own-blockchain-mining-algorithm-in-go-82c6a71aba1f -- You received this message because you are subscribed to the Google Groups "g

Re: [go-nuts] Is there some kind of memory write protection mechanism?

2018-02-26 Thread Andy Balholm
Oops. I left out a couple words. I meant “does not keep”. Andy > On Feb 26, 2018, at 9:23 AM, Andy Balholm wrote: > > There is no guarantee that the unsafe package even exists in every > implementation of Go. For example, I really doubt that GopherJS has it. But > that kee

Re: [go-nuts] Is there some kind of memory write protection mechanism?

2018-02-26 Thread Andy Balholm
compliance yet, but my point here is that it doesn’t need “unsafe” in order to reach that point.) Andy > On Feb 26, 2018, at 7:38 AM, d...@veryhaha.com wrote: > > Will the 3 APIs and the unsafe.Pointer be always there? > Will the "sync/atomic" package get broken? > Th

Re: [go-nuts] Difficulties Using golang.org/x/net/html

2018-01-26 Thread Andy Balholm
because of the final slash. The only elements that are automatically closed are those that are always automatically closed, like . Andy > On Jan 25, 2018, at 11:05 PM, dc0d wrote: > > Solved: problem is component is not a standard html tag. That's why the > parser does not

Re: [go-nuts] http.FileServer: how to serve static files requested from different domains?

2018-01-09 Thread Andy Balholm
Try: http.Handle(“domain1.com/assets/", http.StripPrefix("/", http.FileServer(http.Dir(*webrootdomain1 http.Handle(“domain2.com/assets/", http.StripPrefix("/", http.FileServer(http.Dir(*webrootdomain2 -- You received this message because you are subscribed to the Google Groups "golang

Re: [go-nuts] database/sql : i have a need to use postgresql numeric column data type for currency / money value processing

2018-01-08 Thread Andy Balholm
If all the calculations are going to be in the database, you can just use strings on the Go side. Andy > On Jan 7, 2018, at 6:44 AM, evan wrote: > > c# has a decimal type that i can map my numeric(12,2) column data type to, > but golang doesnt have a decimal type. > > i

Re: [go-nuts] Go Compiler How Work?!

2017-12-13 Thread Andy Balholm
that the target operating system expects.) Andy > On Dec 13, 2017, at 9:31 AM, Compiler wrote: > > Machine Code?! > > please show me github link source file then at they is generate sample > binary... at GOLANG sources. > > On Wednesday, December 13, 2017 at 8

Re: [go-nuts] Go Compiler How Work?!

2017-12-13 Thread Andy Balholm
No, the Go compiler doesn’t actually generate ASM. It generates machine code. So it doesn’t need the help of another compiler or assembler. Andy > On Dec 13, 2017, at 9:00 AM, Compiler wrote: > > i am undrestand compiler steps. > only have problem in code generation step. >

Re: [go-nuts] cgo style question

2017-11-03 Thread Andy Balholm
Use the arr1 style when the length of the C array is known at compile time, and the arr2 style when it’s not known till runtime. Andy > On Nov 3, 2017, at 9:18 AM, DV wrote: > > Which "style" of wrapping a C array in a Go slice is more idiomatic in this > code - htt

Re: [go-nuts] Handling dynamic and unknown number of wait groups?

2017-11-02 Thread Andy Balholm
You can add goroutines to a WaitGroup as you create them. There is nothing that keeps you from calling Add more than once. Andy > On Nov 1, 2017, at 11:10 PM, kanth...@gmail.com wrote: > > I am new to Go and I had read numerous times in various articles that one can > technicall

Re: [go-nuts] Golang, Google App Engine, Windows 10

2017-09-22 Thread Andy Balholm
One reason might be if you’re using a server version of Windows. For some reason, the Linux subsystem is only for consumer versions. Andy > On Sep 21, 2017, at 5:50 AM, Rob Shelby wrote: > > Why would I use Cygwin over Bash For Windows? > > On Thursday, September 21, 2017 at

[go-nuts] Re: After Json unmarshaling big ints become floats

2017-09-21 Thread guoyunling . andy
maybe help for . https://golang.org/pkg/encoding/json/#Decoder.UseNumber 在 2013年8月22日星期四 UTC+8下午11:54:42,Nick Savchenko写道: > > Hi! > > Please, take a look: http://play.golang.org/p/B-gZoo3cTB > > Is there a way to have big ints as ints after unmarshaling json? > > Best Regards, > Nick > > > -- Y

Re: [go-nuts] "html/dom" alternative to html/template for true separation of concerns?

2017-09-14 Thread Andy Balholm
The placeholders never show up in template output. If the data is missing, the placeholders normally just disappear; in some cases there might be an error, depending on exactly what type of “missing.” Andy > On Sep 14, 2017, at 8:14 AM, Karv Prime wrote: > > As it would get a l

Re: [go-nuts] "html/dom" alternative to html/template for true separation of concerns?

2017-09-14 Thread Andy Balholm
would be rendered without escaping. (Then sanitizing the HTML to prevent XSS would be up to you, of course.) The html/template escapes content by default, but there are ways to get around it if you tell it you know what you are doing. Andy > On Sep 13, 2017, at 7:01 PM, Karv Prime wr

Re: [go-nuts] "html/dom" alternative to html/template for true separation of concerns?

2017-09-13 Thread Andy Balholm
Why does automatic escaping make html/template completely impractical? (Or did I guess the antecedent of “it” incorrectly?) Andy > On Sep 13, 2017, at 4:30 PM, Karv Prime wrote: > > Thank you for the heads up. So it is completely impractical for the needed > purpose. > &g

Re: [go-nuts] "html/dom" alternative to html/template for true separation of concerns?

2017-09-13 Thread Andy Balholm
case, but appending a text node to the div would be safe. Andy > On Sep 13, 2017, at 2:10 PM, karv.pr...@gmail.com > <mailto:karv.pr...@gmail.com> wrote: > > I don't know why it's unclear, what I'm proposing, but I'll try a 2nd time: > > Something si

Re: [go-nuts] "html/dom" alternative to html/template for true separation of concerns?

2017-09-13 Thread Andy Balholm
age/Your_templating_engine_sucks_and_everything_you_have_ever_written_is_spaghetti_code_yes_you> You might be interested in goquery (github.com/PuerkitoBio/goquery <http://github.com/PuerkitoBio/goquery>), which provides jQuery-like syntactic sugar over x/net/html. Andy -- You received this message because you are s

Re: [go-nuts] Do you guys use ORMs when working with SQL?

2017-09-11 Thread Andy Balholm
> Why would someone want to switch from PostgreSQL to MySQL? I recently switched a project from PostgreSQL to MySQL. But I sure can’t say I *wanted* to. We were integrating a dependency that only supports MS SQL Server and MySQL. -- You received this message because you are subscribed to the G

  1   2   >