Re: [go-nuts] gob non-optimal serialization in case of interface

2021-04-04 Thread Amnon
I would agree with Axel, that while gob is convenient, it never claims to be optimal. And if you care about size and speed of encoding then it may be worth looking at other serialisation formats. See https://ugorji.net/blog/benchmarking-serialization-in-go for some alternatives On Sunday,

Re: [go-nuts] Should reads from a net.Conn be made to respect a context deadline

2021-04-04 Thread Ian Lance Taylor
On Sun, Apr 4, 2021 at 6:13 AM Sam Whited wrote: > > In a library I have a `func(context.Context, net.Conn)' (more or less, > https://godoc.org/mellium.im/xmpp#NewSession). The context is used > throughout the function to eg. break out of loops, gets passed into > other functions, etc. and the con

Re: [go-nuts] Go code review site?

2021-04-04 Thread Sam Whited
It's not official or Go-specific, but you could try: https://codereview.stackexchange.com/ —Sam On Sun, Apr 4, 2021, at 09:20, Tong Sun wrote: > I remember I've been to a page/site where people can ask for review for > their open source projects, commits, etc. > > Is there such site/service,

Re: [go-nuts] Go code review site?

2021-04-04 Thread Alex Howarth
You could try the Slack channel #reviews on gophers.slack.com -alex On Sun, 4 Apr 2021, 09:20 Tong Sun, wrote: > I remember I've been to a page/site where people can ask for review for > their open source projects, commits, etc. > > Is there such site/service, or my memory has fainted (e.g., it

Re: [go-nuts] gob non-optimal serialization in case of interface

2021-04-04 Thread Robert Engels
Since Dimension can hold any instance type it needs to encode each type for each element of the slice. I would file an enhancement to use RLE when encoding interface slices. It won’t be backwards compatible though. > On Apr 4, 2021, at 10:22 AM, 'Axel Wagner' via golang-nuts > wrote: > >  >

Re: [go-nuts] Re: Update to generics proposal

2021-04-04 Thread roger peppe
On Sun, 4 Apr 2021 at 00:48, Eltjon Metko wrote: > I was fully expecting for floodgates of comments to open again but it > seems we have reached a point of maturity in the generics proposal. > The new proposal really makes the intent much clearer both on the exact vs > underlying type match front

[go-nuts] Re: [ANN] Interactive 2D graphics on an HTML canvas via WebSockets

2021-04-04 Thread Frederik Zipp
manlio@gmail.com schrieb am Sonntag, 4. April 2021 um 19:03:48 UTC+2: > Thanks, it is really interesting. > Thanks. > Do you know if there is a similar module that use the DOM API as target > instead of the Canvas API? > I haven't looked for it, so I don't know if something like that exi

[go-nuts] Re: [ANN] Interactive 2D graphics on an HTML canvas via WebSockets

2021-04-04 Thread Manlio Perillo
Il giorno domenica 4 aprile 2021 alle 10:32:36 UTC+2 Frederik Zipp ha scritto: > I often find myself wanting to visualize simple graphics or even > interactive animations from a Go program without resorting to > platform-dependent or Cgo-based libraries, so I created this Go module: > > https:/

Re: [go-nuts] gob non-optimal serialization in case of interface

2021-04-04 Thread 'Axel Wagner' via golang-nuts
Oh, I should also not, to be fair: You *can* decode the gob into an `[]Dimension`, but you *can't* do the same with json. So, the comparison with json is unfair insofar, as the encoded json is actually incomplete - it doesn't hold the type-information of *which* `Dimension` implementation to use.

Re: [go-nuts] gob non-optimal serialization in case of interface

2021-04-04 Thread 'Axel Wagner' via golang-nuts
I believe it is expected behavior (well… given that the gob format is pretty much defined as "whatever the gob package does", it surely is, at this point). gob is able to decode types completely, without having a "framework" to work on - you need to pass a pointer to `json.Unmarshal`, so that the d

[go-nuts] Re: error comparison not working on type with field

2021-04-04 Thread Shulhan
On Sun, 4 Apr 2021 20:16:15 +0700 Shulhan wrote: > Hi all, > > I found an error that instantiate with type that have field cannot be > compared with the instance of the same type. Here is the test code, > > > type typeErrorWithoutField struct{} > > func (te *typeErrorWithoutF

[go-nuts] gob non-optimal serialization in case of interface

2021-04-04 Thread dev.nul...@gmail.com
Hi, Gob in general is pretty efficient however I am seeing, what seems to be an anomaly in its behavior when it comes to serilazing interfaces. To elaborate, I have a program defining a simple interface called Dimension and a struct Point. *type Dimension interface{}* *type Point struct {* * X,

[go-nuts] Go code review site?

2021-04-04 Thread Tong Sun
I remember I've been to a page/site where people can ask for review for their open source projects, commits, etc. Is there such site/service, or my memory has fainted (e.g., it's for go core only etc)? thanks -- You received this message because you are subscribed to the Google Groups "gola

[go-nuts] error comparison not working on type with field

2021-04-04 Thread Shulhan
Hi all, I found an error that instantiate with type that have field cannot be compared with the instance of the same type. Here is the test code, type typeErrorWithoutField struct{} func (te *typeErrorWithoutField) Error() string { return "typeError"

[go-nuts] Should reads from a net.Conn be made to respect a context deadline

2021-04-04 Thread Sam Whited
In a library I have a `func(context.Context, net.Conn)' (more or less, https://godoc.org/mellium.im/xmpp#NewSession). The context is used throughout the function to eg. break out of loops, gets passed into other functions, etc. and the conn is read from. If the user creates and passes in a context

[go-nuts] Where is the display profile from x/net/idna defined

2021-04-04 Thread Sam Whited
Hi all, Does anyone know where the Display profile from x/net/idna [1] is defined? I thought it corresponded to the rules defined in RFC 5895 [2], but it also appears to apply the Bidi rule and some other things not defined there. Unlike the other profiles the Display one has no comment saying wh

Re: [go-nuts] Update to generics proposal

2021-04-04 Thread 'Axel Wagner' via golang-nuts
On Sun, Apr 4, 2021 at 2:18 PM K. Alex Mills wrote: > This seems like a welcome change and leaves the door open for the future > inclusion of type unions. Nicely done! > > Regarding this approximation operator, I have a question about the > intended meaning of: > > ~struct{ > F int > A string

Re: [go-nuts] Update to generics proposal

2021-04-04 Thread K. Alex Mills
This seems like a welcome change and leaves the door open for the future inclusion of type unions. Nicely done! Regarding this approximation operator, I have a question about the intended meaning of: ~struct{ F int A string } Would this match the following types? type A struct{ F int A

[go-nuts] [ANN] Interactive 2D graphics on an HTML canvas via WebSockets

2021-04-04 Thread Frederik Zipp
I often find myself wanting to visualize simple graphics or even interactive animations from a Go program without resorting to platform-dependent or Cgo-based libraries, so I created this Go module: https://github.com/fzipp/canvas It streams drawing operations and keyboard/mouse/touch events to