[go-nuts] Unicode variable name error

2022-11-05 Thread Nikhilesh Susarla
Hi, https://play.golang.com/p/uXOgD0PNc-p I was trying to declare unicode variable name as Go supports it. The language I used is Telugu. It's corresponding chart (https://unicode.org/charts/PDF/U0C00.pdf) But I get the compilation issue. Am I missing anything ? If I write Japanese variable

Re: [go-nuts] Error Interfaces

2022-11-05 Thread Nikhilesh Susarla
Thank you for the clarification. On Sat, Nov 5, 2022 at 10:37 PM Axel Wagner wrote: > To be clear: The recommendation is *not* to compare strings. The > recommendation is to compare errors by identity and not consider errors > created by different packages to be equal. > > If you desperately

Re: [go-nuts] Underscore symbol

2022-11-05 Thread David Finkel
On Sat, Nov 5, 2022 at 4:57 AM Chris Burkert wrote: > I am curious: from a compiler perspective, does that mean that by using _ > simply less assembler instructions are created by not handling those > registers which relate to _? > > That kind of depends on what you mean by "not handling". Since

Re: [go-nuts] Refactor Asynchronous JS to Go

2022-11-05 Thread Kurtis Rader
On Sat, Nov 5, 2022 at 1:58 PM Shubh Karman Singh wrote: > I am refactoring a JS library to Go. I have some questions but I'm not > able to find some concrete answers for this. > 1. What's the idiomatic way to refactor Asynchronous JS APIs to Go? > 2. How to refactor Callbacks from JS to Golang?

[go-nuts] Re: Refactor Asynchronous JS to Go

2022-11-05 Thread Rusco
Some time ago I compared Functional Reactive Programming FRP with Golang Channels (CSP), might be useful to you as a starter: https://rusco.github.io/ On Saturday, 5 November 2022 at 20:58:54 UTC sksin...@gmail.com wrote: > Hi, > I am refactoring a JS library to Go. I have some questions

[go-nuts] Refactor Asynchronous JS to Go

2022-11-05 Thread Shubh Karman Singh
Hi, I am refactoring a JS library to Go. I have some questions but I'm not able to find some concrete answers for this. 1. What's the idiomatic way to refactor Asynchronous JS APIs to Go? 2. How to refactor Callbacks from JS to Golang? I have seen some Go code which takes function as an input

Re: [go-nuts] Error Interfaces

2022-11-05 Thread 'Axel Wagner' via golang-nuts
To be clear: The recommendation is *not* to compare strings. The recommendation is to compare errors by identity and not consider errors created by different packages to be equal. If you desperately need your error to be considered "the same" as another, the most correct way would be to implement

Re: [go-nuts] Error Interfaces

2022-11-05 Thread Nikhilesh Susarla
The error is coming from other package. So, then have to compare strings. I guess On Sat, 5 Nov 2022 at 22:28, Sean Foley wrote: > If the error is created by your code, then just reuse the same one. > > See >

Re: [go-nuts] Error Interfaces

2022-11-05 Thread Sean Foley
If the error is created by your code, then just reuse the same one. See https://cs.opensource.google/go/go/+/refs/tags/go1.19.3:src/io/io.go;drc=90b40c0496440fbd57538eb4ba303164ed923d93;l=44 If the error is created by code other than your own, and that code does not reuse the same error, then

Re: [go-nuts] Error Interfaces

2022-11-05 Thread Nikhilesh Susarla
Oh I see. What is the best way to compare errors? Here in the above example I can do e.Error() == ErrNotFound.Error() // which returns true Is there any other way rather than string comparison ? Thank you On Sat, Nov 5, 2022 at 10:03 PM Axel Wagner wrote: > Oh and this behavior is documented,

Re: [go-nuts] Error Interfaces

2022-11-05 Thread 'Axel Wagner' via golang-nuts
Oh and this behavior is documented, of course: https://pkg.go.dev/errors#New On Sat, Nov 5, 2022 at 5:32 PM Axel Wagner wrote: > Every invocation of `errors.New` returns a new unique error value, even if > the same error text is used. > That is intentional. It would be confusing, if package A

Re: [go-nuts] Error Interfaces

2022-11-05 Thread 'Axel Wagner' via golang-nuts
Every invocation of `errors.New` returns a new unique error value, even if the same error text is used. That is intentional. It would be confusing, if package A chose the same error sentinel text as package B and suddenly their sentinels compare as equal. If you want error identity between values,

[go-nuts] Error Interfaces

2022-11-05 Thread Nikhilesh Susarla
Same interface comparison https://play.golang.com/p/9hHlTDosYzz Why is the equals too still returning false? Any more details on this? Thank you -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop

Re: [go-nuts] WebAssembly and Filesystem access

2022-11-05 Thread Konstantin Khomoutov
On Fri, Nov 04, 2022 at 02:08:08PM -0700, 'Kevin Chowski' via golang-nuts wrote: [...] > I am on a project which primarily ships a Go command line interface (CLI), > but we have aspirations of using the wasm compilation mode to also > distribute a simple webapp version of it, while sharing most

Re: [go-nuts] Underscore symbol

2022-11-05 Thread Chris Burkert
I am curious: from a compiler perspective, does that mean that by using _ simply less assembler instructions are created by not handling those registers which relate to _? Marcel Huijkman schrieb am Sa. 5. Nov. 2022 um 09:18: > When I explain it during my training I always say it is a trashcan

Re: [go-nuts] Underscore symbol

2022-11-05 Thread Marcel Huijkman
When I explain it during my training I always say it is a trashcan variable, anything you put in is to be ignored on the spot. On Friday, November 4, 2022 at 10:10:20 PM UTC+1 Konstantin Khomoutov wrote: > On Fri, Nov 04, 2022 at 04:58:35AM -0700, Canuto wrote: > > > I'm just starting out with

Re: [go-nuts] go[runtime.rt0_go]: why should 104 be subtracted from g0 stack 64k?

2022-11-05 Thread liiu liiu
Thanks for the info. I submit a pull request to remove it. Ian Lance Taylor 于2022年11月5日周六 06:01写道: > On Thu, Nov 3, 2022 at 7:46 AM liiux...@gmail.com > wrote: > > > > asm_amd64.s > > > > Please explain why 104 should be subtracted from g0 stack? > > Interesting question. The number 104