Re: [go-nuts] Equality of interface of an empty struct - why?

2024-02-26 Thread tapi...@gmail.com
On Tuesday, February 27, 2024 at 3:42:25 PM UTC+8 Jan Mercl wrote: On Tue, Feb 27, 2024 at 6:20 AM tapi...@gmail.com wrote: > From common sense, this is an obvious bug. But the spec is indeed not clear enough. > It doesn't state whether or not comparisons of pointers to two distinct zero-

Re: [go-nuts] Equality of interface of an empty struct - why?

2024-02-26 Thread Jan Mercl
On Tue, Feb 27, 2024 at 6:20 AM tapi...@gmail.com wrote: > From common sense, this is an obvious bug. But the spec is indeed not clear > enough. > It doesn't state whether or not comparisons of pointers to two distinct > zero-size variables should be consistent in a run session. > Though, from

[go-nuts] Re: Failed to compile a generic code using embedded struct

2024-02-26 Thread tapi...@gmail.com
use type Test[T, V interface{A; I}] struct{} instead now. There are still several restrictions in custom generics: https://go101.org/generics/888-the-status-quo-of-go-custom-generics.html On Monday, February 26, 2024 at 10:44:46 PM UTC+8 Albert Widiatmoko wrote: > Hi Go community, > > I

Re: [go-nuts] Equality of interface of an empty struct - why?

2024-02-26 Thread tapi...@gmail.com
On Tuesday, February 27, 2024 at 2:25:46 AM UTC+8 Brien Colwell wrote: Interesting. That seems to break the comparable spec. >> Pointer types are comparable. Two pointer values are equal if they point to the same variable or if both have value nil. Pointers to distinct zero-size variables may

Re: [go-nuts] go/version, "go2.00.1" < "go1.0.0"

2024-02-26 Thread Ian Lance Taylor
On Mon, Feb 26, 2024 at 8:26 PM leo zeng wrote: > > package main > > import "go/version" > > func main() { > var val int > val = version.Compare("go2.00.1", "go1.0.0") > print(val) // -1 > } Please write plain text as plain text. It's difficult to read against a dark background. Tha

[go-nuts] go/version, "go2.00.1" < "go1.0.0"

2024-02-26 Thread leo zeng
package main import "go/version" func main() { var val int val = version.Compare("go2.00.1", "go1.0.0") print(val) // -1 } -- 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

Re: [go-nuts] Equality of interface of an empty struct - why?

2024-02-26 Thread Brien Colwell
>> Note that there are two distinct variables involved (a and b). You’re right. I misread this. > On Feb 26, 2024, at 1:15 PM, Axel Wagner > wrote: > > On Mon, Feb 26, 2024 at 7:25 PM Brien Colwell > wrote: >> Interesting. That seems to break the comparable spec. >

Re: [go-nuts] Equality of interface of an empty struct - why?

2024-02-26 Thread 'Axel Wagner' via golang-nuts
On Mon, Feb 26, 2024 at 7:25 PM Brien Colwell wrote: > Interesting. That seems to break the comparable spec. > > >> Pointer types are comparable. Two pointer values are equal if they > point to the same variable or if both have value nil. Pointers to distinct > zero-size variables may or may not

Re: [go-nuts] Equality of interface of an empty struct - why?

2024-02-26 Thread Brien Colwell
Interesting. That seems to break the comparable spec. >> Pointer types are comparable. Two pointer values are equal if they point to >> the same variable or if both have value nil. Pointers to distinct zero-size >> variables may or may not be equal. >> it would be valid for `==` on pointers to

[go-nuts] Re: Equality of interface of an empty struct - why?

2024-02-26 Thread tapi...@gmail.com
package main var a, b [0]int var p, q = &a, &b func main() { if (p == q) { p, q = &a, &b println(p == q) // false } } On Thursday, February 22, 2024 at 6:55:49 PM UTC+8 Brien Colwell wrote: > I'm confused by this output. It appears that the interface of two > different pointers to an empty str

Re: [go-nuts] Failed to compile a generic code using embedded struct

2024-02-26 Thread 'Sean Liao' via golang-nuts
see https://go.dev/issue/51183 - sean On Mon, Feb 26, 2024, 15:44 Albert Widiatmoko wrote: > Hi Go community, > > I was playing with Go generics and writing some codes, but I faced some > problems. I want to ask questions and help from the community if possible. > Below, I am trying to build a

[go-nuts] Failed to compile a generic code using embedded struct

2024-02-26 Thread Albert Widiatmoko
Hi Go community, I was playing with Go generics and writing some codes, but I faced some problems. I want to ask questions and help from the community if possible. Below, I am trying to build a generic struct via a method through another generic struct. Here's the link to Go Playground: https:

Re: [go-nuts] [gollvm] Are there any plans to sync with LLVM16 or above?

2024-02-26 Thread 'Than McIntosh' via golang-nuts
Hi Sophie, Thanks for the question. The chief blocker for updating gollvm to later versions of LLVM trunk is dealing with LLVM's opaque pointer migration in the gollvm bridge

Re: [go-nuts] assert library with generics?

2024-02-26 Thread roger peppe
I'm biased because I had a big hand in designing the API, but I get a lot of pleasure from using this package: https://pkg.go.dev/github.com/go-quicktest/qt It does a lot more than just "equals" and "not equals" but it's still relatively small and low-dependency. And the error messages when i

Re: [go-nuts] Re: Equality of interface of an empty struct - why?

2024-02-26 Thread 'Axel Wagner' via golang-nuts
I think you should still wait for the outcome of that issue. On Mon, Feb 26, 2024 at 10:39 AM brien colwell wrote: > I learned a lot from this thread, thank you. > > Intuitively the spec seems to conclude a pointer to an empty struct is a > different type of pointer? Normally a pointer wouldn't

Re: [go-nuts] Re: Equality of interface of an empty struct - why?

2024-02-26 Thread brien colwell
I learned a lot from this thread, thank you. Intuitively the spec seems to conclude a pointer to an empty struct is a different type of pointer? Normally a pointer wouldn't be able to change values during execution, so we can do things like key maps by pointers. But if every evaluation of the empty