Re: [go-nuts] Streaming deflate - can't reliably read chunks as they arrive instead of the entire stream

2016-07-14 Thread Nigel Tao
On Fri, Jul 15, 2016 at 9:14 AM, Adam Keeton wrote: > A small self-contained example with this code would be tricky with all of > the websocket handling stuff in the way. You could possibly capture the bytes of each compressed message, and then construct a new websocket-free

Re: [go-nuts] http.Handler method name

2016-07-12 Thread Nigel Tao
On Wed, Jul 13, 2016 at 6:14 AM, Anmol Sethi wrote: > If you were to redesign it now, would you name the method Handle? Also speaking personally, yes. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this

Re: [go-nuts] Re: any way to save an image to 8-bit indexed png format?

2016-07-13 Thread Nigel Tao
On Thu, Jul 14, 2016 at 2:07 AM, wrote: > [haven't actually checked if the PNG package will work with this - but this > would be the way to go if supported] The PNG package should work with this: https://play.golang.org/p/Sxl-nLnecy -- You received this message because you

Re: [go-nuts] Streaming deflate - can't reliably read chunks as they arrive instead of the entire stream

2016-07-13 Thread Nigel Tao
On Thu, Jul 14, 2016 at 12:35 AM, A Keeton wrote: > I'm trying to decompress messages arriving over websockets that are using > permessage-deflate. You say that you're using "per message" deflate... > Each new websockets message is written into buf and then I call Read on

Re: [go-nuts] Streaming deflate - can't reliably read chunks as they arrive instead of the entire stream

2016-07-15 Thread Nigel Tao
On Sat, Jul 16, 2016 at 6:03 AM, Adam Keeton wrote: > Is there a different implementation of deflate that you think I should try? I don't know of any. Sorry. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe

Re: [go-nuts] I get a "Invalid cast. " error when debuging

2016-07-15 Thread Nigel Tao
On Sat, Jul 16, 2016 at 2:33 AM, Konstantin Khomoutov wrote: > Support for Go in gdb is beleived to be suboptimal (and AFAIK the > situation in unlikely to change). Consider trying devle -- which is a > native debugger for Go. Just a small typo: devle should be

Re: [go-nuts] Matrix Library && colour uint32's vs uint8's

2016-07-06 Thread Nigel Tao
On Mon, Jul 4, 2016 at 2:50 PM, simran wrote: > Interestingly though, when i do a colour swap (without any type casting > happening now) - the colour problem is still there. https://github.com/simran91/monkeysee/blob/master/mimage/mimage.go says: r, g, b, a :=

[go-nuts] Go Fonts: request for feedback

2017-02-02 Thread Nigel Tao
Bigelow & Holmes, the designers of the Go Fonts, are preparing an update to those fonts. The changes so far are: • adjusted box/chart/shade/split-integral to align vertically • adjusted shade characters to align vertically & horizontally (more or less aesthetically) • merged the contours of ring

Re: [go-nuts] Problems drawing on frames of an animated gif

2017-02-04 Thread Nigel Tao
On Mon, Jan 23, 2017 at 6:03 AM, kalekold via golang-nuts wrote: > Hmm.. the source gif I'm using must be compressed. Doesn't Go handle > compressed gifs in the same way? When you say 'I may get unexpected results' > is that because the current gif package doesn't

Re: [go-nuts] Go Fonts: request for feedback

2017-02-04 Thread Nigel Tao
On Sun, Feb 5, 2017 at 12:40 AM, Konstantin Khomoutov wrote: > Compare this to how a set of ubiquitous fonts from Microsoft is > rendered with the same settings: ms-alias-none-no-hinting.png -- they > look just great. Yeah, I believe that Microsoft put a *lot* of

Re: [go-nuts] Go Fonts: request for feedback

2017-02-04 Thread Nigel Tao
On Sat, Feb 4, 2017 at 12:12 PM, roger peppe wrote: > More unicode coverage would also be nice. Selfishly I'd like characters for > all those in plan 9's lib/keyboard file > (https://github.com/0intro/plan9/blob/master/lib/keyboard) so I can read the > characters that I can

Re: [go-nuts] Shiny gldriver Texture.Fill

2017-02-24 Thread Nigel Tao
On Sun, Feb 19, 2017 at 6:11 PM, Dmitry Kravchenko wrote: > When will Texture.Fill be implemented in Shiny gldriver? I mailed out https://go-review.googlesource.com/37415 -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To

Re: [go-nuts] ycbcr.go YCbCrToRGB implementation.

2017-02-09 Thread Nigel Tao
On Fri, Feb 10, 2017 at 10:50 AM, wrote: > It seems that all constants above are multiplied by 2^16 to allow the > calculation to be performed with integer arithmetic, before being shifted > back into an 8 bit range. But Y' is multiplied by 0x010100 which is >

Re: [go-nuts] Shiny

2016-08-18 Thread Nigel Tao
On Thu, Aug 18, 2016 at 6:12 PM, Joe Blue wrote: > Do you want anyone to help on the material design "widgets" yet ? It's great that there's community interest in Shiny, but as I said, it's not ready yet. I'll let y'all know when enough has been built and settled that more

Re: [go-nuts] Re: Who wants to use Go to process your camera's raw files?

2016-08-31 Thread Nigel Tao
On Mon, Aug 29, 2016 at 12:27 PM, Jonathan Pittman wrote: > To everyone, I really want to see this live in the golang.org/x/image repo. > Do we need to create a formal proposal for it to live there? Should we do > the initial development in another repo and then

Re: [go-nuts] Re: Who wants to use Go to process your camera's raw files?

2016-09-01 Thread Nigel Tao
On Thu, Sep 1, 2016 at 12:46 PM, Jonathan Pittman wrote: > Does the license need to be the same as the standard Go License if it starts > in another repo and then moves over? IANAL, but that seems best. -- You received this message because you are subscribed to

Re: [go-nuts] Go string to uintptr

2016-09-07 Thread Nigel Tao
On Thu, Sep 8, 2016 at 1:03 AM, Tamás Gulácsi wrote: > for i:=0;i<1<<20;i++{ if a[i]==0 {b=string(a[:i])}} The first part of that could be "for i := range a". You probably want a "break" statement in there too. :-) -- You received this message because you are subscribed

Re: [go-nuts] Go string to uintptr

2016-09-07 Thread Nigel Tao
On Thu, Sep 8, 2016 at 1:03 AM, Tamás Gulácsi wrote: > a:=([1<<20]byte(unsafe.Pointer(retPtr))) Also, the type needs to be pointer-to-array, not array. a:=(*[1<<20]byte)(unsafe.Pointer(retPtr)) -- You received this message because you are subscribed to the Google Groups

Re: [go-nuts] gomobile - detect OS information

2016-10-06 Thread Nigel Tao
On Tue, Oct 4, 2016 at 10:03 PM, Scot Newberry wrote: > I'm evaluating gomobile and building a simple application just display a > text both with OS name (Android, or iOS), OS release... You can at least discriminate Android vs iOS via the runtime.GOOS constant

Re: [go-nuts] WebP encoder

2016-09-22 Thread Nigel Tao
On Fri, Sep 23, 2016 at 4:18 AM, Aarti Parikh wrote: > Is webp encoding in pure go something that may happen in a future release? I'd like to see that, but I have higher priority things to work on. -- You received this message because you are subscribed to the Google

Re: [go-nuts] Crypto/rsa : OAEP documentation can lead to misunderstanding regarding max message length, is it a bug?

2016-09-21 Thread Nigel Tao
On Wed, Sep 21, 2016 at 1:41 AM, AnomalRoil wrote: > So here am I: should I open an issue for a trivial sign mistake in a > sentence in the documentation? Opening an issue would have been fine. In this case, though, I just sent the trivial change out for review:

Re: [go-nuts] truncate float32 to lesser precision (22 bit mantissa)

2016-09-21 Thread Nigel Tao
On Sun, Sep 18, 2016 at 1:57 PM, wrote: > It looked like I would have to use pkg unsafe BTW, you don't have to use package unsafe. Use package math's Float32bits and Float32frombits functions. -- You received this message because you are subscribed to the Google Groups

Re: [go-nuts] Request for advice: Developing for Android

2016-09-21 Thread Nigel Tao
On Thu, Sep 22, 2016 at 12:33 AM, Peter Kleiweg wrote: > How about Go Mobile? Is that useful as a starting point, or should I try to > get to know the system first using Android Studio? What are the capabilities > of Go Mobile? Can it do all the stuff a native app can do,

Re: [go-nuts] Shiny

2016-08-18 Thread Nigel Tao
On Wed, Aug 17, 2016 at 11:11 PM, Seb Binet wrote: > that said, I think it is quite clear that shiny is not yet ready for prime > time, for all the use cases of a complete GUI toolkit. > I hope it will come to that, but it isn't the case yet. Yes, it's not yet ready for

Re: [go-nuts] Proposal: radix sort in /x/exp

2016-08-17 Thread Nigel Tao
On Tue, Aug 16, 2016 at 1:05 PM, Randall Farmer wrote: > I think, in general, a great thing about Go is most stdlib packages scale > well--net/http's still a good pick when you get real traffic, say. Adding > stdlib sorts that are faster for large collections seems in that

Re: [go-nuts] Re: ANNOUNCE: renderview

2016-08-27 Thread Nigel Tao
On Sun, Aug 28, 2016 at 2:57 AM, Michael Jones wrote: > I tried to build but was deterred by build woes. Yeah, all of the "renderview" imports need to be "github.com/TheGrum/renderview" to play well with "go get". -- You received this message because you are subscribed

Re: [go-nuts] iconvg: a compact, binary format for simple vector graphics

2016-10-25 Thread Nigel Tao
On Tue, Oct 25, 2016 at 9:30 PM, roger peppe wrote: > Would there be some advantage in making the Rasterizer > types in shiny/iconvg and image/vector somewhat more > uniform in the types they use? For example, vector.Rasterizer > seems to use f32.Vec2 pairs everywhere, but

Re: [go-nuts] Freetype performance

2016-10-25 Thread Nigel Tao
On Tue, Oct 25, 2016 at 9:40 PM, David M. wrote: > Is the Go freetype library optimized? Should I expect a similar performance > from the original C version? Why freetype don't use an internal cache to > store most frequent characters? Go freetype has had some performance

Re: [go-nuts] Re: iconvg: a compact, binary format for simple vector graphics

2016-10-25 Thread Nigel Tao
On Wed, Oct 26, 2016 at 12:45 AM, Sean Russell wrote: > How did you calculate the SVG sizes? When I download the the icons from the > material design github, the collection of the *_48px.svg icons weighs in at > 3.8MB. You may be double counting the design/ and

Re: [go-nuts] Re: iconvg: a compact, binary format for simple vector graphics

2016-10-27 Thread Nigel Tao
On Wed, Oct 26, 2016 at 4:38 PM, Nigel Tao <nigel...@golang.org> wrote: > SVGZ is indeed smaller, and more expensive to decode, but I don't have > numbers at hand. Oh, I do have a size number. It's only one data point, but look for "gzip" at https://godoc.org/golang.

Re: [go-nuts] Re: Float32 math and slice arithmetics using SIMD

2016-10-27 Thread Nigel Tao
On Thu, Oct 27, 2016 at 9:24 AM, 'simon place' via golang-nuts wrote: > the approach i took was to try to minimise the M/C, so; Sorry for the ignorant question, but what does M/C stand for? -- You received this message because you are subscribed to the Google

Re: [go-nuts] Re: Float32 math and slice arithmetics using SIMD

2016-10-27 Thread Nigel Tao
On Fri, Oct 28, 2016 at 6:54 AM, 'simon place' via golang-nuts wrote: > however, from looking at it, couldn’t find documentation, that code is > specific to speeding up graphics overlays? maybe? (accumulate) Yes, speeding up an accumulation step, described at

Re: [go-nuts] Problem with alpha blending using image/draw

2016-11-08 Thread Nigel Tao
On Wed, Nov 9, 2016 at 4:14 AM, wrote: > I'm trying to write out a png with an alpha component as a jpeg. As I > understand it, I should be able to use the draw package to do this. > > // src is an image.RGBA > newImg := image.NewRGBA(src.Bounds()) > >

Re: [go-nuts] iconvg: a compact, binary format for simple vector graphics

2016-11-06 Thread Nigel Tao
On Tue, Oct 25, 2016 at 9:30 PM, roger peppe wrote: > Would there be some advantage in making the Rasterizer > types in shiny/iconvg and image/vector somewhat more > uniform in the types they use? For example, vector.Rasterizer > seems to use f32.Vec2 pairs everywhere, but

[go-nuts] iconvg: a compact, binary format for simple vector graphics

2016-10-24 Thread Nigel Tao
I was looking for a compact, binary format for simple vector graphics. I didn't find one that did all I wanted. SVG is the de facto standard for vector graphics, in the open source world. Unfortunately, https://www.w3.org/TR/SVG/single-page.html prints as 400 pages, not including the XML, CSS or

Re: [go-nuts] Re: iconvg: a compact, binary format for simple vector graphics

2016-10-25 Thread Nigel Tao
On Tue, Oct 25, 2016 at 4:31 PM, Daniel Theophanes wrote: > My understanding is that the original rust font render code could replace > something like FreeType. Do you envision using iconvg and vector as a > replacement for the go freetype package, where font glyphs would be

Re: [go-nuts] iconvg: a compact, binary format for simple vector graphics

2016-10-25 Thread Nigel Tao
On Tue, Oct 25, 2016 at 2:13 AM, Pietro Gagliardi wrote: > I wonder if there's a way to simulate elliptical gradients with only circular > gradients and affine transformations, so package ui can also render these > files directly using the system native vector graphics

Re: [go-nuts] bug report?: go font box drawing is wrong

2016-11-28 Thread Nigel Tao
On Mon, Nov 28, 2016 at 5:28 PM, wrote: > Sorry if this is the wrong place. This place is as good as any other. Thanks for the bug report. I'll pass it on to Bigelow & Holmes. -- You received this message because you are subscribed to the Google Groups "golang-nuts"

Re: [go-nuts] Re: Suggestion: port golang.org/x/mobile/exp/audio/al to Windows

2016-11-20 Thread Nigel Tao
On Mon, Nov 21, 2016 at 10:24 AM, wrote: > How to submit a change request? If you're asking about how to submit code that you have written yourself, the contribution guidelines are at https://golang.org/doc/contribute.html If you are asking how to file a feature request,

Re: [go-nuts] Re: Float32 math and slice arithmetics using SIMD

2016-11-02 Thread Nigel Tao
On Tue, Nov 1, 2016 at 8:58 PM, Ondrej wrote: > It seems that a universal binary, as Go requires it, would be slow on > dispatch, because there would be too much checking for individual intrinsics > support. Do I understand it correctly, that to overcome this, people

Re: [go-nuts] Freetype performance

2016-10-28 Thread Nigel Tao
On Sat, Oct 29, 2016 at 2:11 AM, David M. wrote: > Here is the profiling: Ah, in package freetype, face.Glyph results (glyph images) are cached but face.GlyphAdvance and face.Kern results are not. Thanks for the bug report, I filed

Re: [go-nuts] gob ignores default values, bug or feature?

2016-12-14 Thread Nigel Tao
On Sat, Dec 10, 2016 at 11:14 PM, Matthew Zimmerman wrote: > Yes, it makes them smaller I agree, however shouldn't the lack of a value on > decoding be considered like a zero value was encoded? I think that is the > question here. It's pretty much academic at this point,

Re: [go-nuts] Re: database/sql and custom column types

2016-12-03 Thread Nigel Tao
On Sat, Dec 3, 2016 at 4:26 AM, wrote: > A quick aside regarding the code that you posted. Postgres (bizarrely, IMHO) > stores longitude first, then latitude, so: Well, the usual order is "latitude, longitude", but on the standard visualization (North is 'up' on typical maps),

Re: [go-nuts] Processing Images with baked data

2016-11-30 Thread Nigel Tao
On Wed, Nov 30, 2016 at 4:46 AM, wrote: > I know there is an image package that exist in Golang that implements encode > and decode functionality, but how can I get other data from an image?. For > example I am trying to get iTXt chunks from PNG images, is there any

Re: [go-nuts] Packaging Test Utilities in a Project

2016-12-18 Thread Nigel Tao
On Sun, Dec 18, 2016 at 1:51 PM, Henry wrote: > I have reusable test utilities in a project. They are used by various > packages in the project for testing purposes, and at the same time I don't > want to expose these utilities as public APIs. Since it is impossible to

Re: [go-nuts] bug report?: go font box drawing is wrong

2016-12-21 Thread Nigel Tao
On Mon, Nov 28, 2016 at 5:28 PM, wrote: > The ascenders for blocks, lines, etc are all wrong and it's very > distracting. I'm enjoying go mono in the terminal so far but it's tedious to > go through every file and delete the problematic character ranges. Can these > be

Re: [go-nuts] Trouble with fonts

2016-12-07 Thread Nigel Tao
On Wed, Dec 7, 2016 at 5:49 PM, Lucio wrote: > The first issue is one of documentation. It says in > that: > > DrawBytes draws s at the dot and advances the dot's location. > > But it leaves the question of what exactly those bytes

[go-nuts] New Smallcaps Go Fonts; other Go Fonts updated

2017-03-29 Thread Nigel Tao
Bigelow & Holmes have prepared new versions of the Go Fonts that we released late last year (https://blog.golang.org/go-fonts). The version numbers have changed from 2.004 to 2.008. ChangeLog: * New! 2 new fonts, bringing the total to 12: Go Smallcaps and Go Smallcaps Italic. * New! U+FFFD

Re: [go-nuts] golint if/else stmt and early returns

2017-03-16 Thread Nigel Tao
This is tangential, but if we're talking about style, you might be able to simplify this line ret = PropertiesList(ret).Append(PropertiesList(temp)) to be ret = PropertiesList(ret).Append(temp) if the PropertiesList underlying type and the temp variable's type are what I'm guessing they are:

Re: [go-nuts] Re: uint type safety in go

2017-03-16 Thread Nigel Tao
On Fri, Mar 17, 2017 at 5:02 AM, 'simon place' via golang-nuts wrote: > uint - uint = int Well, if the first uint is maxUint and the second uint is minUint (i.e. zero), then the difference between them will overflow an int. -- You received this message because you

Re: [go-nuts] json.Unmarshal and modifications to copies of structs

2017-03-13 Thread Nigel Tao
On Mon, Mar 13, 2017 at 9:10 AM, george.robinson via golang-nuts wrote: > Can someone explain to me how this prints "test world" twice? I had expected > to see "test hello" and "test world". > > https://play.golang.org/p/E7CRQNE6oT m1 is not a pointer, but m1.S is a

Re: [go-nuts] Initializing aliased map

2017-07-07 Thread Nigel Tao
On Sat, Jul 8, 2017 at 8:08 AM, wrote: > How do I initialize `b` here to have the zero value of `aliased`? To be precise, b is already initialized by default to its zero value, which is nil. If you want a non-nil but empty map, then as Shawn said, you can use "b:

Re: [go-nuts] Why does this program carry test flags once compiled?

2017-07-22 Thread Nigel Tao
On Sat, Jul 22, 2017 at 7:08 PM, Howard Guo wrote: > https://github.com/HouzuoGuo/laitos It's tangential to your question, but out of curiousity, I skimmed the source code. In things like func TestUDPServer in

Re: [go-nuts] Weird performance with exp/shiny

2017-04-28 Thread Nigel Tao
On Fri, Apr 28, 2017 at 12:28 PM, Zellyn wrote: > I'm sure I'm doing something hideously wrong with shiny, since my emulator > runs three times faster on my MacBook if I run it under VirtualBox/Ubuntu. > Yes, you read that right. > Here, I tweeted an animated gif of them running

Re: [go-nuts] Is x/exp/shiny dead?

2017-07-31 Thread Nigel Tao
On Tue, Aug 1, 2017 at 6:25 AM, fazal wrote: > It was one of the things I was looking forward to, but I see almost no > activity there, which makes me sad. It's certainly not very active right now. I work part time, for uninteresting reasons, and shiny is unfortunately

Re: [go-nuts] License for x/image/testdata and x/image/font/testdata files

2017-08-19 Thread Nigel Tao
se like the rest of the repo. For the x/image/font/testdata/fixed subdirectory, there is a README that contains license notes. For x/image/testdata, I think "git log" is the best source of per-file license notes. For example: $ git log testdata/tux.png commit 94ba43c4786221df328229f6

Re: [go-nuts] x/term: go-keycodes

2017-05-11 Thread Nigel Tao
On Fri, May 12, 2017 at 3:11 AM, anatoly techtonik wrote: > I am new to Go and I need a cross-platform value for keyboard key codes to > make sure I can react to user key presses regardless of operating system > layer. FYI, there's already the key.Code type defined in

Re: [go-nuts] x/term: go-keycodes

2017-05-17 Thread Nigel Tao
On Sun, May 14, 2017 at 6:02 PM, anatoly techtonik <techto...@gmail.com> wrote: > On Fri, May 12, 2017 at 7:54 AM, Nigel Tao <nigel...@golang.org> wrote: >> On Fri, May 12, 2017 at 3:11 AM, anatoly techtonik <techto...@gmail.com> >> wrote: >>> I am n

Re: [go-nuts] AI-first?

2017-06-01 Thread Nigel Tao
On Fri, Jun 2, 2017 at 7:17 AM, Ian Lance Taylor wrote: > The golang-nuts mailing list is a good place to talk about Go-first > (or Go-second or Go-last). It's not a good place to talk about AI. > Thanks. In case there is any confusion, this list is about Go the programming

[go-nuts] Re: Why is Shiny's text rendering quantizes to the pixel grid?

2017-09-21 Thread Nigel Tao
On Sat, Sep 16, 2017 at 2:26 AM, David Crawshaw wrote: > On Fri, Sep 15, 2017 at 7:35 AM, Elias Naur wrote: >> Is there a fundamental reason to quantize the baseline? The >> golang.org/x/image/font package offers (fixed point) subpixel accuracy, so >>

Re: [go-nuts] Go Fonts: Double double copyright notice in gomono.TTF and friends

2017-10-05 Thread Nigel Tao
On Sun, Oct 1, 2017 at 8:50 AM, as wrote: > The official go fonts contain two identical copyright notices inside the TTF > data slice. One in UTF-8 and one in UTF16 format. These make their way into > the final go binary. Bug or intentional TTF standard? Intentional,

Re: [go-nuts] shiny driver.Main not returning

2017-09-07 Thread Nigel Tao
For the record, the OP filed https://github.com/golang/go/issues/21796 -- 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.

Re: [go-nuts] Re: error handling needs syntactical sugar

2017-09-07 Thread Nigel Tao
On Thu, Sep 7, 2017 at 4:00 PM, Tim Uckun wrote: > I don't see anything wrong with the try catch paradigm, Try-catch makes for shorter code when you're just passing the buck, but it can be quite complicated when you actually need to handle the buck. My showcase example for

Re: [go-nuts] Re: How to read multi-page TIFF image?

2017-09-27 Thread Nigel Tao
On Tue, Sep 26, 2017 at 1:55 AM, Guy Allard wrote: > Adding support for multiple IFDs to the go package being discussed seems not > too difficult (reading the existing code). > > Suggest trying to contact the package authors. Hi, I'm one of the authors of the

Re: [go-nuts] Re: How to read multi-page TIFF image?

2017-09-28 Thread Nigel Tao
On Thu, Sep 28, 2017 at 10:28 AM, Michael Jones wrote: > Not quite related, but if changes are going to happen, I want to add (or see > someone add) colorspace tags to the PNG code and the TIFF code. It's not exactly what you're asking for, but there are already issues

Re: [go-nuts] new project: pixels to svg

2017-09-01 Thread Nigel Tao
On Sat, Sep 2, 2017 at 12:50 AM, wrote: > Feel free to give me feedback on how I can improve the code or the project > setup, etc. I had a quick look. Some thoughts on style, in no particular order: 0. Run gofmt. Your code mixes tabs and spaces, amongst other issues. Gofmt

Re: [go-nuts] [ANN] Frame - Plan9 libframe in Go

2017-10-11 Thread Nigel Tao
On Wed, Oct 11, 2017 at 2:30 PM, as wrote: > https://github.com/as/frame Nice! -- 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

Re: [go-nuts] Re: Learning Go: suggestions for code review?

2017-12-13 Thread Nigel Tao
On Thu, Dec 14, 2017 at 1:44 AM, Ben Hoyt wrote: > I used the "dot" import for tokenizer so I can just use "if p.tok == COMMA" > instead of "if p.tok == tokenizer.COMMA" everywhere. As per https://golang.org/doc/effective_go.html#mixed-caps ALL_CAPS names are unusual Go style.

Re: [go-nuts] The side effect of calling html.Token()

2018-01-15 Thread Nigel Tao
On Sun, Jan 14, 2018 at 4:33 PM, Tong Sun wrote: > Not being able to do that, I have to save all the Token() info to different > variables, then pass all those variables to my function separately, instead > of passing merely a single tokenizer. Instead of using different

Re: [go-nuts] Re: iconvg: a compact, binary format for simple vector graphics

2018-01-17 Thread Nigel Tao
On Thu, Jan 18, 2018 at 1:53 AM, wrote: > I'm wondering if you know any c/cpp implementation of your renderer I don't know of a C/C++ implementation, sorry. If you find (or write) one, let me know! -- You received this message because you are subscribed to the Google

Re: [go-nuts] The side effect of calling html.Token()

2018-01-13 Thread Nigel Tao
On Fri, Jan 12, 2018 at 2:24 PM, Tong Sun wrote: > but I really suggest that you give it a test. It is already tested directly by func TestTokenizer in token_test.go The Tokenizer.Text method implementation does not call Tokenizer.Next, and only the Next method moves on to

Re: [go-nuts] The side effect of calling html.Token()

2018-01-11 Thread Nigel Tao
On Wed, Jan 3, 2018 at 1:03 PM, Tong Sun wrote: > Shouldn't Token() be better returning the current on > instead of the next? You're right. I sent out https://go-review.googlesource.com/c/net/+/87515 -- You received this message because you are subscribed to the Google

Re: [go-nuts] Space-optimization question

2018-09-05 Thread Nigel Tao
On Thu, Sep 6, 2018 at 12:22 AM Eric Raymond wrote: > Matters in my case because the deserialization of a repository history can > contain hundreds of thousands of constants like "M", "D", "R", and "C" > representing fast-export stream file operation types. I could intern them > explicitly but

Re: [go-nuts] Re: Generics as builtin typeclasses

2018-09-06 Thread Nigel Tao
On Fri, Sep 7, 2018 at 9:29 AM 'Axel Wagner' via golang-nuts wrote: > On Fri, Sep 7, 2018 at 12:37 AM Ian Lance Taylor wrote: >> Interesting point. But is there any way to solve it short of >> explicitly listing types? Is there any generics system in any >> language that avoids this problem? >

Re: [go-nuts] Reflecting on an outer struct from a method of an inner one.

2018-09-06 Thread Nigel Tao
On Fri, Sep 7, 2018 at 9:34 AM Eric Raymond wrote: > The attached program lists For future reference, it would probably be easier for the mailing list to discuss example code via a link to the Go playground, especially for runnable code. In this case: https://play.golang.org/p/IripNZNYIgo > In

Re: [go-nuts] Reflecting on an outer struct from a method of an inner one.

2018-09-07 Thread Nigel Tao
Building on Todd's example, you can add a little more type safety (having the map value type be a "func etc" instead of "reflect.Value) by Curry'ing the receiver: https://play.golang.org/p/n3sDpxfd2td I've also split up the single run function into two: one binds strings to functions, the second

Re: [go-nuts] Reflecting on an outer struct from a method of an inner one.

2018-09-06 Thread Nigel Tao
On Fri, Sep 7, 2018 at 1:53 PM Eric Raymond wrote: > ...provided, that is, that it's possible to get from the member name to a > function pointer that can be called like a closure. Does the reflection > system support such a call-indirect method? Yep. No embedding or other inheritance-like

Re: [go-nuts] Reference to type satisfying a specified interface

2018-08-30 Thread Nigel Tao
On Fri, Aug 31, 2018 at 4:18 AM Burak Serdar wrote: > If b is an interface to a *Blob, what's stored in the slice is {Type: > *Blob, Value: pointer to the object}. A copy of this interface value > is also in the map. So you have two copies of the interface value, > both pointing to the same Blob

Re: [go-nuts] Reference to type satisfying a specified interface

2018-08-30 Thread Nigel Tao
On Fri, Aug 31, 2018 at 11:41 AM Eric Raymond wrote: > On Thursday, August 30, 2018 at 8:31:44 PM UTC-4, Ian Lance Taylor wrote: >> Which docs did you look at? Just wondering what could be updated. > > This: https://research.swtch.com/interfaces I'm only guessing, but I think Ian's "which docs

Re: [go-nuts] Re: http "alt" attribute value for img tag?

2018-04-21 Thread Nigel Tao
package main import ( "fmt" "log" "strings" "golang.org/x/net/html" ) func main() { const src = ` message ` doc, err := html.Parse(strings.NewReader(src)) if err != nil { log.Fatal(err) } var f func(*html.Node) f = func(n *html.Node) { if n.Type == html.ElementNode && n.Data == "img" {

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

2018-04-23 Thread Nigel Tao
Nice! On Mon, Apr 23, 2018 at 3:41 AM, Steven Wiley wrote: > I refactored and enhanced the raster package from the golang translation > of freetype, > It'd be a bunch of work, but you might consider basing off of

Re: [go-nuts] Failed iterator proposals?

2018-10-25 Thread Nigel Tao
On Fri, Oct 26, 2018 at 6:04 AM robert engels wrote: > Barring that, I don’t see how > > for(i:=c.Iterator();i.HasNext();) { > v := i.Next() > } > > is that much more difficult to use Yes, an iterator with a Next method (possibly with another name) is the idiomatic way to present

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

2018-11-29 Thread Nigel Tao
On Thu, Nov 29, 2018 at 9:20 PM Jan Mercl <0xj...@gmail.com> wrote: > - To me type name 'fixed.Fixed' sounds like Javaism. Well, there's already context.Context, hash.Hash, image.Image and time.Time in the standard library. Perhaps, in a parallel universe, we could have settled on the testing.T

[go-nuts] Wuffs: a new, memory-safe programming language

2019-01-08 Thread Nigel Tao
Spun out of the "C++ 11 to Golang convertor" thread... On Mon, Jan 7, 2019 at 12:27 AM Eric S. Raymond wrote: > Perry and I have two different target languages in mind. Perry's > target language is basically a repaired C - type-safe, almost > upward-compatible. He and I have the same strategic

Re: [go-nuts] Re: Wuffs: a new, memory-safe programming language

2019-01-11 Thread Nigel Tao
On Fri, Jan 11, 2019 at 5:46 PM Nigel Tao wrote: > On Fri, Jan 11, 2019 at 4:22 AM robert engels wrote: > > Again, what is wrong with the bounds checking/memory protection > > library/technique for C I referred you to? Even a decrease in performance > > will probably stil

Re: [go-nuts] Re: golang.org/x/text/language does not match sr-Latn (Serbian in a Latin script) with hr (Croatian) as it documents that it should

2019-03-01 Thread Nigel Tao
CC'ing mpvl@, the blog post author. On Sat, Mar 2, 2019 at 1:16 AM wrote: > > I did a bit more digging and found this: > > https://go-review.googlesource.com/c/text/+/55331/ > > Which states: > > "language: remove manual hr -> sr mapping was removed in CLDR for > geo-political reasons" > >

Re: [go-nuts] Re: Go vs C speed - What am I doing wrong?

2019-02-12 Thread Nigel Tao
On Mon, Feb 4, 2019 at 5:34 AM Miki Tebeka wrote: > A bit of profiling shows that the modulo operator takes most of the time: C's modulo operator is faster, but can crash if you look at it funny. $ cat x.c #include int main(int argc, char** argv) { int x = -2147483648; int y = -1;

Re: [go-nuts] Re: Go vs C speed - What am I doing wrong?

2019-02-12 Thread Nigel Tao
On Wed, Feb 13, 2019 at 11:23 AM Nigel Tao wrote: > Yes, both the Go code and the C code will panic if y is zero. Still, > "-2147483648 % -1" has a sensible mathematical definition (zero), and > C fails to calculate it. I forgot to mention that, even with a mod-by-zero,

Re: [go-nuts] S2: High speed compression with upgrade path from Snappy.

2019-08-27 Thread Nigel Tao
On Tue, Aug 27, 2019 at 7:25 PM Klaus Post wrote: > Can the concurrent decompression run on a pure stream, or does it need to > read the index first? It cannot run a pure stream. As the https://github.com/google/wuffs/blob/master/doc/spec/rac-spec.md Overview section says, an explicit non-goal

Re: [go-nuts] Re: S2: High speed compression with upgrade path from Snappy.

2019-08-27 Thread Nigel Tao
On Mon, Aug 26, 2019 at 9:49 PM Jason E. Aten wrote: > It sounds like it does, but just to be clear: does S2 also replace/upgrade > the snappy *streaming* format (the outer format that is different from snappy > itself; e.g. https://github.com/glycerine/go-unsnap-stream )? Tangential, but the

Re: [go-nuts] S2: High speed compression with upgrade path from Snappy.

2019-08-27 Thread Nigel Tao
On Mon, Aug 26, 2019 at 8:29 PM Klaus Post wrote: > This package is aimed at replacing Snappy as a high speed compression > package. If you are mainly looking for better compression zstandard gives > better compression, but typically at speeds slightly below "better" mode in > this package.

Re: [go-nuts] S2: High speed compression with upgrade path from Snappy.

2019-08-28 Thread Nigel Tao
On Wed, Aug 28, 2019 at 7:11 PM Klaus Post wrote: > TLDR; LZ4 is typically between the default and "better" mode of s2. Nice! Just a suggestion: rename "better" to either "betterSize / smaller" (i.e. better compression ratio, worse throughput) or "betterSpeed / faster", otherwise it's not

Re: [go-nuts] S2: High speed compression with upgrade path from Snappy.

2019-08-27 Thread Nigel Tao
Nice work, Klaus! On Mon, Aug 26, 2019 at 8:29 PM Klaus Post wrote: > Concurrent stream compression - several GB/sec. > Faster decompression A number of modern compression formats and implementations allow for concurrent *compression*. Coincidentally, I've been working on a format that allows

Re: [go-nuts] Go without garbage collector

2020-02-13 Thread Nigel Tao
On 2/13/20, robert engels wrote: > See this paper/project https://github.com/hundt98847/multi-language-bench > that was done by Google > in 2011. > > ... > > Or Java is almost 2x faster than C++, and Go is nearly the same performance > as C++.

Re: [go-nuts] Language proposal: labelled "with" statements to help make test code easier to write

2020-03-01 Thread Nigel Tao
On Mon, Mar 2, 2020 at 8:06 AM Warren Stephens wrote: > It could made to look more Go-like... > >internal mystep2(lines, thing2): (mymap, err) Ian isn't talking about the particular syntax (e.g. punctuation or keywords). He is talking about the semantics (statements that hide scope, hidden

Re: [go-nuts] Re: Language proposal: labelled "with" statements to help make test code easier to write

2020-03-06 Thread Nigel Tao
On Thu, Mar 5, 2020 at 10:32 AM Warren Stephens wrote: > There is a bunch of "goto nonsense" added to get the Go compiler to accept > the 4 labels Well then, don't use labels, so you don't need nonsense (or the dummy parameter). Cutting them out (https://play.golang.org/p/SUalTGaAxmx) runs

Re: [go-nuts] Experience report on a large Python-to-Go translation

2020-01-29 Thread Nigel Tao
On Wed, Jan 29, 2020 at 11:05 PM Axel Wagner wrote: > On Wed, Jan 29, 2020 at 12:57 PM Nigel Tao wrote: >> For example, the https://golang.org/pkg/io/#LimitedReader struct just >> exports its fields, and you use it like this >> (https://go.googlesource.com/go/+/ref

Re: [go-nuts] Experience report on a large Python-to-Go translation

2020-01-29 Thread Nigel Tao
Great write-up. > Keyword arguments should be added to the language. In idiomatic Go, we often use struct literals (together with "make the zero value useful", e.g. allocate map-typed fields lazily) instead of object-creation functions: x := { A: a, B: b.c(), } instead of x =

Re: [go-nuts] Re: Experience report on a large Python-to-Go translation

2020-01-29 Thread Nigel Tao
On Mon, Jan 27, 2020 at 3:23 PM Eric Raymond wrote: > Consider a parser in which your handler function for a given token or subtree > consists of a bunch of if/then returns, and not matching one of them means > you should throw upwards to an error handler. FWIW,

Re: [go-nuts] Re: Experience report on a large Python-to-Go translation

2020-02-04 Thread Nigel Tao
On Tue, Feb 4, 2020 at 8:56 PM Jason E. Aten wrote: > b := helper(i: 2) > > would give you the whole new {x:0, y:0, i:2} back in b. I'm not sure how helpful that really is, given that you can already write: b := {i: 2} -- You received this message because you are subscribed to the Google

  1   2   >