[go-nuts] Re: x/text/unicode/bidi - how to draw attention to two bugs?

2025-04-05 Thread Andy Balholm
On both of them, someone did a mention of @mpvl (Marcel van Lohuizen), so I assume he is the primary maintainer of the package, and everyone else is waiting for him to do something. Andy On Thursday, March 20, 2025 at 6:23:09 AM UTC-7 Patrick wrote: > Hello all, > > I have opened two issues fo

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] [ANN] Pack: Interfaces for LZ77-based data compression

2021-09-20 Thread Andy Balholm
Many data-compression schemes are conceptually composed of two steps: LZ77 (finding repeated sequences) and entropy encoding. But I've never found a compression library that treats those steps as separate components. So I made one: github.com/andybalholm/pack. It defines interfaces for the two

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 mistaken. Andy On 9

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

2021-03-29 Thread Andy Balholm
It is likely a code for GOARCH=amd64. Back in the distant past, there were separate Go compilers for different CPU architectures. The one for amd64 was 6g, for 386 it was 8g, etc. It looks like the x86 directory is code that was originally written for amd64, and then generalized to cover 386 a

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

2021-03-15 Thread Andy Balholm
By the way, this existed at one point. Early versions of the Go toolchain included C compilers (6c, 8c, etc.) designed to work together nicely with Go code. If I remember right, most of the Go runtime was written in C, and compiled with these compilers. But they used an unusual dialect of C (wh

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 make a simple ht

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
Right. That’s why I left the double bar in my example. Basically all the time is spent appending to a linked list in regexp/syntax.patchlist.append. Which makes sense, because appending to a linked list when you only have a head pointer is O(n) in the length of the list. So building the whole

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

2020-06-11 Thread Andy Balholm
Java. > Any recommendations for Go profilers for this work would be appreciated. > > Ray > > > > > On Thu, Jun 11, 2020 at 1:36 PM Andy Balholm <mailto:andybalh...@gmail.com>> wrote: > Here is a simpler reproducer: https://play.golang.org/p/82UBmyfyqV- > &l

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
hat regex? > >> On Jun 11, 2020, at 11:01 AM, Andy Balholm wrote: >> >> It’s apparently quadratic in some cases. Yesterday fuzzing on >> github.com/andybalholm/cascadia <http://github.com/andybalholm/cascadia> >> found an input that triggered a timeout.

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 processor type to optimize

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 function has the type *os

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, otherwise > the dental products

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, at 5

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
> On Nov 25, 2019, at 9:54 AM, Liam wrote: > > - does the read-to-EOF stipulation also apply to Client.Get/Post() ? Yes. Those methods are fairly simple wrappers around Do. > - why does Response.Body.Close() before io.EOF not release unread buffers or > otherwise prepare it for persistence?

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

2019-09-18 Thread Andy Balholm
As I understand it, the issue isn’t actually about SSLv2 itself. It’s that clients that support SSLv2 use an old handshake format. In that handshake, they can advertise support for SSLv3 and maybe even TLS 1. So if crypto/tls added support for the handshake but not the rest of SSLv2, they could

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 serving the request have t

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

2019-07-04 Thread Andy Balholm
I recently ran across 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 enclosing parse construct aft

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 unsubscribe from this group and stop receivin

[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 "golang-n

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 AM,

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

2019-05-17 Thread Andy Balholm
That’s probably true of the spoken language; American spelling, on the other hand, has changed more than British spelling. This is mostly a result of Noah Webster’s attempts to simplify it. King James Version Bibles generally follow the spelling of the 1769 Oxford printing, and the spelling is

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: > Does Go GC destroy all gl

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

2019-05-01 Thread Andy Balholm
You could have a cleaner switch statement if you had a list of the keys that were pressed, instead of needing to check each one individually: func whichKeys(keysToCheck ...keyID) []keyID { var result []keyID for _, k := range keysToCheck { if rl.IsKeyDown(k) {

[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
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/brotli.) I’d like to share what I’ve learned. I tried various tools: rsc/c2go, elliotchance/c2go, Konstantin8105/c4go, and a tool that I devel

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

2019-01-18 Thread Andy Balholm
The -er suffix makes sense when you think of a method invocation as a command, telling an object to do something. This was definitely the model in Smalltalk, where people called them “messages.” In Go, methods are more like functions than in Smalltalk, but some of the idea remains in the naming

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

2019-01-05 Thread Andy Balholm
Yes, the preprocessor… The preprocessor is one of the biggest obstacles to readable C-to-Go translation. rsc/c2go largely ignores preprocessor directives other than #include—and it doesn’t include a translation of the headers at the top of every output file. But most C programs are a lot more d

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

2019-01-03 Thread Andy Balholm
It’s at https://github.com/rsc/c2go . It might be a good starting place, but there is one significant difference in approach from what Eric is proposing. Russ incorporated all of the manual cleanup into the tool (or config files) as special cases, rather than leaving

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

2019-01-03 Thread Andy Balholm
code used > CGo for all of its work. > > It gets really difficult for multithreaded apps, pthread does not translate > to Go routines, no TLS, etc. > > I think correcting the converted Go would be more daunting that just > rewriting it in Go to begin with. > &g

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

2019-01-03 Thread Andy Balholm
I’ve been working on a tool (called leaven) to convert LLVM IR (intermediate representation) to Go. So you can compile C to LLVM with clang, and then convert the result to Go. It’s actually pretty easy, because LLVM instructions are such simple operations. But it’s not very readable; given this:

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 wrote: > > "I

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 伊藤和也 > wrote: > > > Wha

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

2018-12-06 Thread Andy Balholm
That would definitely be possible. But it isn’t likely to happen. It would make the rule several times more complicated that it currently is, to fix something that only happens occasionally, is caught at compile time, and is easily taken care of with an explicit type conversion. That doesn’t sou

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

2018-12-05 Thread Andy Balholm
:54 AM, Michel Levieux wrote: > > Well the only thing I do in the main is : > > fmt.Println(v) > > Shouldn't the compiler statically type v to uint64? > I don't get the need to force type of v to uint64? > > Le mer. 5 déc. 2018 à 17:45, Andy Balholm

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 we look > at package math

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

2018-11-24 Thread Andy Balholm
There is nothing in the language spec that guarantees anything about performance. But if logic tells you that it should be a no-op, and examination of the generated code shows you that it is a no-op in the cases you tested, you can safely assume that it is not going to be an issue for your progr

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
t 7:59 PM, Lucio wrote: > > The word "elegant" comes to mind... Comments below. > > On Monday, 5 November 2018 21:47:46 UTC+2, Andy Balholm wrote: > The concept of using operators to implement methods cross-pollinated in my > mind with Patrick’s “Go Generics with A

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

2018-11-05 Thread Andy Balholm
The concept of using operators to implement methods cross-pollinated in my mind with Patrick’s “Go Generics with Adaptors” thought experiment and produced this: https://gist.github.com/andybalholm/acecba3acf57bf1254142dadce928890

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

2018-11-03 Thread Andy Balholm
I thought of a way to do something similar to the “implements” proposal without introducing operator overloading: turn it around. Instead of letting methods implement operators, we could let operators implement methods. type Lesser(type T) interface { Less(b T) bool for(<) } This interf

Re: [go-nuts] Regarding contracts

2018-10-26 Thread Andy Balholm
018, at 9:41 AM, Burak Serdar wrote: > > On Thu, Oct 25, 2018 at 10:32 AM Andy Balholm <mailto:andybalh...@gmail.com>> wrote: >> >> >> >> On Oct 25, 2018, at 6:45 AM, Marvin Renich > <mailto:m...@renich.org>> wrote: >> >> Th

Re: [go-nuts] Regarding contracts

2018-10-25 Thread Andy Balholm
> On Oct 25, 2018, at 6:45 AM, Marvin Renich wrote: > > The most powerful feature of the contracts described in the original > design draft is the ability to describe interactions between two types > in a type specification. Your proposal doesn't seem to allow this. See the section of my gist

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 Andy > On Oct 23, 2018, at 9:37 AM, Burak Serdar

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
It seems to me that what you are proposing with “implements” is not really a replacement for contracts. It would do something that contracts don’t (unify operators and methods), and it wouldn’t do nearly all of what contracts do (clearly define what is expected of type parameters across a wide r

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, Burak Serdar wrot

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 group and stop receiving

Re: [go-nuts] Regarding contracts

2018-10-17 Thread Andy Balholm
I think there are serious issues with your syntax for functions and “templates.” For example, there doesn’t seem to be a way to specify that two parameters to a function need to be the same type, or that the return type will be the same as the parameter. The syntax from the official proposal is

Re: [go-nuts] Regarding contracts

2018-10-17 Thread Andy Balholm
That’s a very interesting idea. It would probably need to be extended to allow specifying that a type is like multiple types. Then the effective “contract” would be the intersection of the operations provided by those types. For example, we would want to be able to specify a type that is like bo

[go-nuts] Operators in interfaces

2018-10-17 Thread Andy Balholm
Warning: yet another generics-related idea ahead. :-) The motivation for using contracts instead of interfaces as the type constraints in the Go 2 generics proposal is the fact that interfaces only allow one type of operation: method calls. And we’d like to be able to use other operations, such

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] [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

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
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 keep GopherJS from being compliant with the Go spec and the Go 1 compatibility guarantee. (I’m not sure whether GopherJS is to the point of full co

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

2018-01-26 Thread Andy Balholm
The prescription is correct; the diagnosis is close but not exactly right. The html package actually doesn’t pay any attention to the XML-style self-closing tag syntax. It accepts it, in accordance with the HTML5 spec, as an alternate style of opening tag, but it never closes an element just bec

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'm trying to avoid sto

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. > so best way is this

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 - https://play.golang.org/p/6EbK

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 > technically create any nu

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 8:17:04 AM UTC-4

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

2017-09-14 Thread Andy Balholm
do forget about > proper sanitization of user-input. As I'm pretty focused on security, I know > about the implications of many design-approaches. Easy-to-use approaches are > neat and in that certain case super useful - but sadly not for my use-case. ^^ > > @Andy Balholm: No,

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

2017-09-14 Thread Andy Balholm
ote: > > It = html/template > "The purpose" = the one I thought I could use it for and described above. > > Am Donnerstag, 14. September 2017 03:58:02 UTC+2 schrieb Andy Balholm: > Why does automatic escaping make html/template completely impractical? (Or > did I guess

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

2017-09-13 Thread Andy Balholm
a database all hell should break loose) - but > as files could under certain circumstances also be user-created (i.E. some > esoteric database where every blog entry is a file) there's a problem here. > One can't prevent coders from making mistakes. PHP tried, it failed. ^^ Java

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

2017-09-13 Thread Andy Balholm
You may not be aware that the html/template package does automatic escaping. So if a template has {{.Blogpost}} and Blogpost contains alert(“Pwned”), the result will be something like Assigning to the div’s innerHTML would be bad in this case, but appending a te

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

2017-09-13 Thread Andy Balholm
It sounds like what you’re wanting to do is basically what is called Template Animation at http://www.workingsoftware.com.au/page/Your_templating_engine_sucks_and_everything_you_have_ever_written_is_spaghetti_code_yes_you

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

Re: [go-nuts] Storing uint64 values in DB

2017-07-29 Thread Andy Balholm
var i uint64 var j int64 … j = int64(i) This performs the same conversion that C would do automatically when assigning i to j, but Go requires you to be a little more explicit. > On Jul 29, 2017, at 6:54 PM, Tong Sun wrote: > > Neither PostgreSQL[1] nor SQLite[2] support unsigned 64-bit intege

Re: [go-nuts] No Allman-Style, No go!

2017-07-29 Thread Andy Balholm
I’ve always considered the lexer to be part of the compiler, and apparently Ecstatic Coder does too, considering his complaint. Andy > On Jul 29, 2017, at 2:58 PM, Jan Mercl <0xj...@gmail.com> wrote: > > On Sat, Jul 29, 2017 at 10:43 PM Andy Balholm <mailto:andybalh...

Re: [go-nuts] No Allman-Style, No go!

2017-07-29 Thread Andy Balholm
It’s not quite true that the compiler doesn’t care about white space. The lexer is part of the compiler, and it does care about white space. The semicolon insertion rule, in particular, pays attention to newlines. So, while the compiler doesn’t care about indentation at all, there are some brac

Re: [go-nuts] pet peeve: it's Go not golang

2017-07-25 Thread Andy Balholm
Even “go game of life” works. Some search engines may treat “of” as a stopword, but Google gives it some weight. Andy > On Jul 25, 2017, at 4:18 PM, Skip Tavakkolian > wrote: > > I was specifically referring to things posted to this list to avoid the old > chestnut about search. > > For wha

Re: [go-nuts] slow Mod function in math/big, a better way?

2017-07-08 Thread Andy Balholm
I noticed your “naive explanation” after I sent my message. But I think it is the real explanation. Is there a better way to do it in Go? Probably not. The math/big library isn’t quite as fast as gmp, but it’s probably faster than anything you’d write yourself. If the numbers were really huge,

Re: [go-nuts] slow Mod function in math/big, a better way?

2017-07-07 Thread Andy Balholm
That’s normal for languages like Python. The code that is actually running in Python is slow, but library functions are fast, because they are written in C. Andy > On Jul 7, 2017, at 4:51 AM, jeff.templon.nik...@gmail.com wrote: > > Hi > > Exploring Go, 1st project is to port over my favourite

[go-nuts] http2.Transport connections seem to occasionally get "stuck"

2017-07-05 Thread Andy Balholm
Users of github.com/andybalholm/redwood (an HTTP proxy) are running into an intermittent problem that I suspect is an HTTP/2 bug. But it is very difficult to pin down. The symptom reported by the customers is that, for an hour or two, all connections to Google servers through the proxy time out

Re: [go-nuts] letsencrypt, localhost and autocert

2017-06-06 Thread Andy Balholm
What it boils down to is that your server tries to get a certificate for whatever name is in the URL. But Let’s Encrypt won’t issue a certificate for localhost, for various reasons—not the least of which is that a certificate for localhost makes as much sense as having a photo ID that says “Me”

Re: [go-nuts] understanding utf-8 for a newbie

2017-05-05 Thread Andy Balholm
Hexdump shows the actual bytes in the file—the UTF-8 encoding of the runes (Unicode code points). Apparently you are reading them with utf8.DecodeRune or something like that; those return the code points, without the UTF-8 encoding. Andy -- You received this message because you are subscribed

Re: [go-nuts] [ANN] sqlite

2017-04-25 Thread Andy Balholm
This discussion piqued my interest, and I decided to see what I could do to make rsc.io/c2go more general-purpose. My fork is at github.com/andybalholm/c2go . I think that, with appropriate .h and .cfg files, it can now handle the tests fr

Re: [go-nuts] [ANN] sqlite

2017-04-21 Thread Andy Balholm
As near as I can tell, this is an intermediate step in a project whose ultimate goal is to compile sqlite into Go—asm.go (a style like asm.js), apparently. Andy -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and

Re: [go-nuts] Go -> C++ transpiler idea: Miracle child or horrible abomination?

2017-03-28 Thread Andy Balholm
If global ownership inference, with enough flexibility to replace a garbage collector, were practical, I suppose the Rust compiler would have it already. But if you want to prove the Rust developers wrong, go ahead and do it in a transpiler. Andy -- You received this message because you are s

Re: [go-nuts] The feature I want most, weak *

2017-02-09 Thread Andy Balholm
I expect you’re just left with the option of magic comments then, since there’s not going to be much enthusiasm for adding a new do-nothing keyword to the language. Andy -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this

Re: [go-nuts] The feature I want most, weak *

2017-02-09 Thread Andy Balholm
Maybe you could use “notwithstanding". It’s an ignored token in the default Go compiler, and a weak pointer is one that allows an object to be freed notwithstanding any weak references to it… It’s not in the spec, though, so it might cause problems with other Go implementations such as gccgo. I

Re: [go-nuts] VERY weird timezone behavior

2017-02-04 Thread Andy Balholm
Note the date that is printed with the times. Since Jan. 1 of year zero (1 BC?) predates the establishment of standard time zones, Go converting from 1:00 PM mean solar time at Stockholm to 12:53 PM mean solar time at Berlin. (Or is the time used at Stockholm something different? It doesn’t seem

Re: [go-nuts] Appending a path to an URL

2017-01-31 Thread Andy Balholm
The part being added is treated as an absolute path, because it starts with a slash, so it replaces the existing path. Andy > On Jan 31, 2017, at 2:09 PM, Manlio Perillo wrote: > > Il giorno martedì 31 gennaio 2017 18:35:02 UTC+1, Manlio Perillo ha scritto: > Thanks, I was not aware of this be

Re: [go-nuts] Help - main.go:15: undefined: say

2017-01-30 Thread Andy Balholm
You defined say inside main, but Super is defined outside main, so say is not in scope there. Move the definition of say outside of main, so that it is a top-level (global) declaration. Andy PS Even after you do that, your program will print 9000 rather than 19000, because Super is modifying a

Re: [go-nuts] What is use for [:] of a slice?

2017-01-30 Thread Andy Balholm
Most likely they originally used an array, and changed it to a slice later. Since that line still compiled, it didn’t get changed. Or else they are just confused. Anyway, I can’t think of any reason to use [:] on a slice either. Andy -- You received this message because you are subscribed to

Re: [go-nuts] Migrating from a classic OO pattern

2017-01-30 Thread Andy Balholm
The second thing you tried is usually the best way to do this in Go: define an interface with the methods that vary by type, and then make a function with the type-independent logic. It’s actually cleaner in many cases than the classic OO way with overriding methods, but a direct translation fro

Re: [go-nuts] should every .gz file be served with content-encoding gzip?

2017-01-14 Thread Andy Balholm
est to a foo request? Why should a user want to have > a .gz file after downloading? > > On Sat, Jan 14, 2017 at 1:31 PM Andy Balholm <mailto:andybalh...@gmail.com>> wrote: > It all depends on what the user wants to have when they are done downloading. > In the case of HTML, CS

Re: [go-nuts] should every .gz file be served with content-encoding gzip?

2017-01-14 Thread Andy Balholm
It all depends on what the user wants to have when they are done downloading. In the case of HTML, CSS, and JS, they want an uncompressed file that is ready for their browser to use. So you should use Content-Encoding: gzip and Content-Type: text/html or whatever. In the case of a .tar.gz, they

Re: [go-nuts] Google Grumpy (Python->Go)

2017-01-04 Thread Andy Balholm
Finally, a way to deploy a Python program as a statically-linked binary! The Go code this produces looks awful. It’s more like threaded code in Go syntax than like real Go. It translated my toy benchmark function def count(x): i = 1 while i <= x: i += 1 into

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

2016-12-30 Thread Andy Balholm
On Dec 30, 2016, at 4:43 AM, paraiso.m...@gmail.com wrote: > > Ultimately even if you stick to SQL you are just also writing your own ORM , > you just can't generalize code because of Go type system. There are really two separate (but related) issues in the ORM debate: the ORM design pattern, a

Re: [go-nuts] howto: compile template against well-known structure ?

2016-12-19 Thread Andy Balholm
I don’t know if this will be helpful to you or not, but I’ve made a package that is basically a copy/paste of the autoescaping logic from html/template, but modified to work at runtime instead of when compiling a template: github.com/andybalholm/escaper I

Re: [go-nuts] How to speed up execution time for a set of regular expressions

2016-12-13 Thread Andy Balholm
Right. Aho-Corasick can’t be used directly in that case. But it might still be a major performance win to use Aho-Corasick for the first pass, and then confirm with regexes. In other words, if the Aho-Corasick stage finds “associate,” then check whether /associate.*with/ matches. Andy -- You

  1   2   >