Re: [go-nuts] [generics] Constraint type inference not working

2020-08-18 Thread jake...@gmail.com
Submitted https://github.com/golang/go/issues/40859 On Tuesday, August 18, 2020 at 12:59:21 AM UTC-4 Ian Lance Taylor wrote: > On Sun, Aug 16, 2020 at 7:42 AM jake...@gmail.com > wrote: > > > > When I try the example from the "Constraint type inference" section of > the Draft Design: >

Re: [go-nuts] Re: Why we don't have simple throws error statement

2020-08-18 Thread Yasar Semih Alev
Another idea, if we use blank identifier for errors then throws statement catch these with caller function name. func printSum(a, b, c string) error { throws func(caller string, err error) { fmt.Println("caller:", caller, err) return err }() x, _ :=

Re: [go-nuts] [generics] Type list syntax

2020-08-18 Thread Jan Mercl
On Tue, Aug 18, 2020 at 4:38 PM Frederik Zipp wrote: > The draft syntax for type lists is a comma separated list: > > type SignedInteger interface { > type int, int8, int16, int32, int64 > } > > Wouldn't it be more consistent with existing Go syntax regarding types if it > was a

Re: [go-nuts] [Generics] Constraints package name

2020-08-18 Thread Frederik Zipp
ma...@acln.ro schrieb am Montag, 27. Juli 2020 um 08:34:04 UTC+2: > The entire notion of the constraints package feels a little suspicious to > me. What if the comparable and ordered constraints were pre-declared in the > universe block, and the numeric constraint were named math.Numeric? > In

Re: [go-nuts] [generics] Type list syntax

2020-08-18 Thread 'Axel Wagner' via golang-nuts
I think in the overwhelmingly common case (a type-list being a list of identifiers or short type-constructors like channels or slices), having a line per item takes up a lot of vertical real-estate for little use. Also, hopefully, almost never would really use them anyway, with basically all

[go-nuts] [generics] Type list syntax

2020-08-18 Thread Frederik Zipp
The draft syntax for type lists is a comma separated list: type SignedInteger interface { type int, int8, int16, int32, int64 } Wouldn't it be more consistent with existing Go syntax regarding types if it was a semicolon separated list in curly braces? type SignedInteger

Re: [go-nuts] [generics] Type list syntax

2020-08-18 Thread Frederik Zipp
Jan Mercl schrieb am Dienstag, 18. August 2020 um 16:45:54 UTC+2: > i.e not a list containing possibly eg. type literals/anonymous types. > Yes, I wanted to interpret a type list conceptually as an anonymous type embedded in an interface. -- You received this message because you are

Re: [go-nuts] [generics] Type list syntax

2020-08-18 Thread Frederik Zipp
axel.wa...@googlemail.com schrieb am Dienstag, 18. August 2020 um 17:44:16 UTC+2: > I think in the overwhelmingly common case (a type-list being a list of > identifiers or short type-constructors like channels or slices), having a > line per item takes up a lot of vertical real-estate for

Re: [go-nuts] [generics] Type list syntax

2020-08-18 Thread Frederik Zipp
Jan Mercl schrieb am Dienstag, 18. August 2020 um 16:45:54 UTC+2: > I don't think so. The type list in this case is syntactically just an > identifier list, i.e not a list containing possibly eg. type > literals/anonymous types. > I just looked into the draft design again: If composite types

Re: [go-nuts] [generics] Type list syntax

2020-08-18 Thread 'Axel Wagner' via golang-nuts
On Tue, Aug 18, 2020 at 8:29 PM Frederik Zipp wrote: > The more I think about it the less I understand why type list should > reside inside interfaces. I can only think of two reasons: > > 1) Avoid a new keyword for type lists. > 2) The idea that only interfaces should be able to act as

Re: [go-nuts] [generics] Type list syntax

2020-08-18 Thread Ian Lance Taylor
On Tue, Aug 18, 2020 at 7:38 AM Frederik Zipp wrote: > > The draft syntax for type lists is a comma separated list: > > type SignedInteger interface { > type int, int8, int16, int32, int64 > } > > Wouldn't it be more consistent with existing Go syntax regarding types if it > was a

Re: [go-nuts] [generics] Type list syntax

2020-08-18 Thread Ian Lance Taylor
On Tue, Aug 18, 2020 at 1:48 PM Frederik Zipp wrote: > > Ian Lance Taylor schrieb am Dienstag, 18. August 2020 um 21:26:23 UTC+2: >> >> What would it mean to permit any type as a constraint? > > > Each type would match exactly the same types it would match in a plain old > function parameter

Re: [go-nuts] [generics] Type list syntax

2020-08-18 Thread Frederik Zipp
Ian Lance Taylor schrieb am Dienstag, 18. August 2020 um 21:26:23 UTC+2: > What would it mean to permit any type as a constraint? > Each type would match exactly the same types it would match in a plain old function parameter list: type MyStruct struct{} func (s MyStruct) M() {} == Type

Re: [go-nuts] New linker

2020-08-18 Thread Amnon
Ian, Than - thanks for the info and the hard work. Looking forward to putting the new linker through its paces! On Tuesday, 18 August 2020 20:35:54 UTC+1, Ian Lance Taylor wrote: > > On Sat, Aug 15, 2020 at 11:49 PM Amnon > > wrote: > > > > Austin's doc refers to your idea of a new object

[go-nuts] Help: Encrypting and Decrypting ASCII armor PGP Messages with golang.org/x/crypto/openpgp

2020-08-18 Thread Samuel Lorch
Hi, i have been trying to decrypt and encrypt ASCII armor PGP Messages that i receive and send to a API. I Wrote a function for decrypting messages and another one for encrypting messages. The Decrypting function Works and i can decrypt the API's messages. But My encrypt function Seems to

Re: [go-nuts] [generics] Type list syntax

2020-08-18 Thread 'Axel Wagner' via golang-nuts
On Tue, Aug 18, 2020 at 6:00 PM Frederik Zipp wrote: > axel.wa...@googlemail.com schrieb am Dienstag, 18. August 2020 um > 17:44:16 UTC+2: > >> I think in the overwhelmingly common case (a type-list being a list of >> identifiers or short type-constructors like channels or slices), having a >>

Re: [go-nuts] Re: Why we don't have simple throws error statement

2020-08-18 Thread Denis Cheremisov
Even worse: no idea where the error actually happened. вторник, 18 августа 2020 г. в 13:33:54 UTC+3, semi...@gmail.com: > Another idea, if we use blank identifier for errors then throws statement > catch these with caller function name. > > func printSum(a, b, c string) error { > throws

Re: [go-nuts] [generics] Type list syntax

2020-08-18 Thread Frederik Zipp
Frederik Zipp schrieb am Dienstag, 18. August 2020 um 19:44:05 UTC+2: > I agree it is a weird combination. Ideally it would be: > > 1. `anyof` declarations containing only types, usable as constraints and > types > 2. `interface` declarations containing only methods, usable as constraints > and

Re: [go-nuts] [generics] Type list syntax

2020-08-18 Thread 'Axel Wagner' via golang-nuts
On Tue, Aug 18, 2020 at 9:04 PM Frederik Zipp wrote: > I'd argue that every type expresses a certain subset of types, not just > interfaces. For the other types the size of the subset just happens to be 1 > (each containing just itself). > You can certainly argue that. Though FTR, conceptually

Re: [go-nuts] New linker

2020-08-18 Thread Ian Lance Taylor
On Sat, Aug 15, 2020 at 11:49 PM Amnon wrote: > > Austin's doc refers to your idea of a new object format for the 21st century. > Has anyone developed that? No, that is still just a thought. > As someone who has been writing linkers since 1988, (most famously the Gold > linker), and who has a

Re: [go-nuts] New linker

2020-08-18 Thread 'Than McIntosh' via golang-nuts
To add to what Ian mentioned: Many of the measures outlined in https://golang.org/s/better-linker have been implemented at this point. It was a multi-person effort, several members of the Go compiler/runtime team were involved (Jeremy, Cherry, Austin, and myself). The new indexed object file

Re: [go-nuts] [generics] Type list syntax

2020-08-18 Thread Frederik Zipp
The more I think about it the less I understand why type list should reside inside interfaces. I can only think of two reasons: 1) Avoid a new keyword for type lists. 2) The idea that only interfaces should be able to act as constraints. Regarding 2): Why this artificial limitation? Why not

Re: [go-nuts] [generics] Type list syntax

2020-08-18 Thread Frederik Zipp
axel.wa...@googlemail.com schrieb am Dienstag, 18. August 2020 um 19:19:32 UTC+2: > 1. `anyof` declarations, only usable as types > 2. `interface` declarations containing only methods, usable as constraints > and types > 3. `interface` declarations containing methods and type-lists ("embedded

Re: [go-nuts] [generics] Type list syntax

2020-08-18 Thread Frederik Zipp
axel.wa...@googlemail.com schrieb am Dienstag, 18. August 2020 um 20:47:12 UTC+2: > We already have a way to express "any of a certain subset of types", which > are interfaces, so using them for constraints is natural. > I'd argue that every type expresses a certain subset of types, not just

Re: [go-nuts] [generics] Type list syntax

2020-08-18 Thread Ian Lance Taylor
On Tue, Aug 18, 2020 at 11:29 AM Frederik Zipp wrote: > > The more I think about it the less I understand why type list should reside > inside interfaces. I can only think of two reasons: > > 1) Avoid a new keyword for type lists. > 2) The idea that only interfaces should be able to act as

Re: [go-nuts] Why was islibrary not set correctly when using -buildmode=c-shared with gccgo compiler

2020-08-18 Thread Yonatan Gizachew
But may I know what gccgo's runtime package? On Wednesday, August 19, 2020 at 8:52:48 AM UTC+9 Ian Lance Taylor wrote: > On Mon, Aug 17, 2020 at 10:42 PM Yonatan Gizachew > wrote: > > > > Sorry I couldn't provide code to reproduce the case, but I just wanted > to know if there are known cases

Re: [go-nuts] Why was islibrary not set correctly when using -buildmode=c-shared with gccgo compiler

2020-08-18 Thread Yonatan Gizachew
Oh, thanks for clarification. For your question, not for now. On Wednesday, August 19, 2020 at 8:52:48 AM UTC+9 Ian Lance Taylor wrote: > On Mon, Aug 17, 2020 at 10:42 PM Yonatan Gizachew > wrote: > > > > Sorry I couldn't provide code to reproduce the case, but I just wanted > to know if

Re: [go-nuts] Why was islibrary not set correctly when using -buildmode=c-shared with gccgo compiler

2020-08-18 Thread Ian Lance Taylor
On Mon, Aug 17, 2020 at 10:42 PM Yonatan Gizachew wrote: > > Sorry I couldn't provide code to reproduce the case, but I just wanted to > know if there are known cases for my issue. > From the golang source code, in the runtime library proc.go file there is > this code snippet >

Re: [go-nuts] Why was islibrary not set correctly when using -buildmode=c-shared with gccgo compiler

2020-08-18 Thread Ian Lance Taylor
On Tue, Aug 18, 2020 at 6:20 PM Yonatan Gizachew wrote: > > But may I know what gccgo's runtime package? https://go.googlesource.com/gofrontend/+/refs/heads/master/libgo/go/runtime/ https://go.googlesource.com/gofrontend/+/refs/heads/master/libgo/runtime/ Ian > On Wednesday, August 19, 2020