Re: [go-nuts] reflect and generic type or func?

2021-02-07 Thread xie cui
the branch dev.go2go will print some thing like 'instantiate୦୦String୦string', i will in the release of generic it wouldn't looks like this? On Saturday, February 6, 2021 at 12:02:52 AM UTC+8 axel.wa...@googlemail.com wrote: > It's impossible to tell, as that code is invalid. You didn't define

[go-nuts] generics of go?

2021-02-07 Thread xie cui
i try to run the generic code, i find two branch dev.go2go, dev.typeparams, the branch dev.go2go will translate generic to to no generic code and run it, as far as i know. but i find the commit in dev.typeparams is more friendly for me to read, so how can i run the generic code by using dev.ty

Re: [go-nuts] reflect and generic type or func?

2021-02-07 Thread 'Axel Wagner' via golang-nuts
No. The go2go tool is a prototype that rewrites generic go code into normal go code, fed to the normal compiler. It generates types and functions with mangled names as you observed (the mangled names need to remain valid Go identifiers, but also shouldn't clash with other names, which is why they l

Re: [go-nuts] SFTPGo 2.0.0 Released

2021-02-07 Thread Dimas Prawira
Nice.. Best regards On Sat, Feb 6, 2021, 18:38 Nicola Murino wrote: > Hi all, > > I'm pleased to announce SFTPGo 2.0.0! > > SFTPGo is a fully featured and highly configurable SFTP server with > optional FTP/S and WebDAV support, written in Go. It can serve local > filesystem, S3 (compatible) Ob

[go-nuts] Hacking gc to support methods on builtin types

2021-02-07 Thread Luke Champine
Hi all, Recently, I managed to get this to work: x := []int{1, 2, 3} x.reverse() fmt.Println(x) That is, when I run my modified compiler on this code, it prints [3, 2, 1]. Neat! To be clear, I am *not* intending to get this merged upstream -- this is just a fun exercise to learn m

[go-nuts] Re: Hacking gc to support methods on builtin types

2021-02-07 Thread Brian Candler
> If you were tasked with adding a builtin method to all slices, how would you do it? Did you consider making a global function, like copy() and append() ? Why does it have to be a method? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To un

Re: [go-nuts] generics of go?

2021-02-07 Thread Ian Lance Taylor
On Sun, Feb 7, 2021 at 2:49 AM xie cui wrote: > > i try to run the generic code, i find two branch dev.go2go, dev.typeparams, > the branch dev.go2go will translate generic to to no generic code and run it, > as far as i know. but i find the commit in dev.typeparams is more friendly > for me to

[go-nuts] Re: Hacking gc to support methods on builtin types

2021-02-07 Thread Luke Champine
Yep, in fact I have already added min and max functions that return the lesser/greater of their two arguments. Adding builtin functions is much easier than builtin methods, since other builtin functions are already supported by the compiler. You just add a new op type to gc/syntax.go, then add

[go-nuts] WMI and Go... where to get started?

2021-02-07 Thread Tom Limoncelli
I've been using Unix for decades (and Go since the pre-releases) and now I find myself needing to use Go to talk to the Windows WMI system. There isn't a lot of GO-specific documentation and I could use help figuring out where to get started. Sadly google searches for getting started with WMI are a

Re: [go-nuts] [generics] notes on adding generics to a package

2021-02-07 Thread Martin Leiser
I follow the discussion about go generics for some time now, but never tried using them. Your conclusion > I struggled to grasp generics at the outset of this experiment. They are complex in a way that I haven’t encountered in a while with Go: I wasn’t sure when to reach for them and when to us

Re: [go-nuts] [generics] notes on adding generics to a package

2021-02-07 Thread 'Axel Wagner' via golang-nuts
Some immediate thoughts on that: 1. It seems like a strange design decision, to let the importer mess with *any* exported interface type. In general, Go takes a pretty firm stance that the semantics of a package should be determined by its author - for example, you can't add new methods to types.

Re: [go-nuts] Quick question about the generics alternatives that have been considered

2021-02-07 Thread atd...@gmail.com
Forget about it. Does not work. Can't avoid having to constrain types. An algorithm for value types would not be so easily usable with pointer types, at the very least because of nil checks. And, although it might not be a problem, if we ever have type list interfaces, or even simple multi-para

[go-nuts] about -buildmode c-shared

2021-02-07 Thread Frédéric De Jaeger
Hi, this is a followup of https://groups.google.com/g/golang-dev/c/J7W3sDexK18 that I've mistakenly posted in the wrong channel. I feel ashamed about it. Ian Lance Taylor wrotes: > *This is a consequence of the fact that (on most systems) shared libraries share a symbol namespace, so t