Re: [go-nuts] The Generics Proposal has been accepted!

2021-02-12 Thread Ian Lance Taylor
On Fri, Feb 12, 2021 at 7:39 AM Amnon wrote: > > And should be out in 1.17 (this Autumn). > > Congratulations to all those who made it happen, > and to the Go team for making sure that the design was right before it > was accepted. Thanks! But, a clarification: we are targeting the 1.18 release

Re: [go-nuts] Grouped functions...

2021-02-11 Thread Ian Lance Taylor
On Thu, Feb 11, 2021 at 4:09 PM Trig wrote: > > So, in Go... you can either define imports, constants, types, variables one > at a time... or you can group them using brackets. Why was it decided not to > be able to do that with functions? Just curious. > > func ( > main() { >

Re: [go-nuts] cas ABA problem?

2021-02-09 Thread Ian Lance Taylor
On Tue, Feb 9, 2021 at 11:18 AM xie cui wrote: > > https://github.com/golang/go/blob/master/src/runtime/proc.go#L5926 > how the cas in this line avoid ABA problem? The ABA problem occurs if some thread compares the value to A, and then a different thread changes the value to B and then changes

Re: [go-nuts] about -buildmode c-shared

2021-02-08 Thread Ian Lance Taylor
mless one. > Ian Lance Taylor wrotes: > > > This is a consequence of the fact that (on most systems) shared > libraries share a symbol namespace, so that all references to, say, > runtime.chansend are resolved to the same function. If different Go > shared libraries built using

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

Re: [go-nuts] Re: Possible Go 2 proposal for built-in Remove method for Slices.

2021-02-05 Thread Ian Lance Taylor
On Fri, Feb 5, 2021 at 6:46 AM Fernando Meyer wrote: > I understand the pragmatism behind having or not features in the language > and its standard library. But, almost all the golang projects I've worked > with implement their own utility function to remove elements from a slice, > sometimes

Re: [go-nuts] go.mod: 1: module: not found

2021-02-02 Thread Ian Lance Taylor
is supported. "go build -n | sed | sh" is not supported. Ian > On Tuesday, February 2, 2021 at 5:33:27 AM UTC+5:30 Ian Lance Taylor wrote: >> >> On Mon, Feb 1, 2021 at 1:42 PM saurav deshpande >> wrote: >> > >> > it just contains: >> > >>

Re: [go-nuts] How to improve the parallelism of go routine?

2021-02-01 Thread Ian Lance Taylor
On Mon, Feb 1, 2021 at 4:07 PM Wojciech S. Czarnecki wrote: > > Dnia 2021-02-01, o godz. 11:12:22 > Ian Lance Taylor napisał(a): > > > On Mon, Feb 1, 2021 at 9:33 AM 颜文泽 wrote: > > > > go version go1.13 linux/amd64 > > > Goroutines that run for a l

Re: [go-nuts] go.mod: 1: module: not found

2021-02-01 Thread Ian Lance Taylor
February 2, 2021 at 3:04:39 AM UTC+5:30 Ian Lance Taylor wrote: >> >> On Mon, Feb 1, 2021 at 11:24 AM saurav deshpande >> wrote: >> > >> > We have a go.mod file. >> > The same make file worked with go 1.9.7 version, it did not support mod. >

Re: [go-nuts] Re: C function return value of type float changes when used with COG

2021-02-01 Thread Ian Lance Taylor
On Mon, Feb 1, 2021 at 1:52 PM Robert M. Münch wrote: > > I know all about the problems of FP comparison, and yes I know that I need to > provide more information. What makes me suspicious is, that I have a bunch of > equivalent tests before the failing one, and all pass. I still believe in the

Re: [go-nuts] go.mod: 1: module: not found

2021-02-01 Thread Ian Lance Taylor
o.mod file look like? Ian > On Tuesday, February 2, 2021 at 12:48:51 AM UTC+5:30 Ian Lance Taylor wrote: >> >> On Mon, Feb 1, 2021 at 10:35 AM saurav deshpande >> wrote: >> > >> > Hello, I am trying to run a make file but it gives me the following error: &

Re: [go-nuts] go.mod: 1: module: not found

2021-02-01 Thread Ian Lance Taylor
On Mon, Feb 1, 2021 at 10:35 AM saurav deshpande wrote: > > Hello, I am trying to run a make file but it gives me the following error: > go.mod: 1: module: not found > go 1.15: unknown command ... > go.o: > @mkdir -p $(BUILD_DIR) > @echo "[go] compiling go sources into a standalone .o file" >

Re: [go-nuts] How to improve the parallelism of go routine?

2021-02-01 Thread Ian Lance Taylor
On Mon, Feb 1, 2021 at 9:33 AM 颜文泽 wrote: > > > $ go version > go version go1.13 linux/amd64 > > > I'm not sure how to deal with this phenomenon when I find that the parallel > performance using go routine is not very good when writing database(olap) > code. What does runtime.GOMAXPROCS(0)

Re: [go-nuts] If the go program compiled by a completely static compiled version of go binary compiler will also be static automatically?

2021-01-31 Thread Ian Lance Taylor
On Sun, Jan 31, 2021 at 5:54 AM Hongyi Zhao wrote: > > If the go program compiled by a completely static compiled version of go > binary compiler will also be static automatically? To be more specific, on > Ubuntu 20.04, I've compiled the latest git master version of go compiler in a >

Re: [go-nuts] C function return value of type float changes when used with COG

2021-01-31 Thread Ian Lance Taylor
On Sun, Jan 31, 2021 at 9:14 PM Robert M. Münch wrote: > > I have a C library with some test-cases (using googletest) that all pass. I > created Go bindings for the C lib and converted the tests to testify format. > > Some Go test fails because a return value from the C function (type float) is

Re: [go-nuts] where is the g writebuf flushed?

2021-01-31 Thread Ian Lance Taylor
On Sun, Jan 31, 2021 at 12:22 PM arthurwil...@gmail.com wrote: > > in runtime/print.go gwrite, if the data is put in the gp.writebuf where does > that writebuf get flushed? The gp.writebuf field is only used to implement runtime.Stack. It isn't flushed anywhere, it's just returned to the

Re: [go-nuts] normal mode and starve mode of sync.Mutex and runtime mutex?

2021-01-31 Thread Ian Lance Taylor
On Sun, Jan 31, 2021 at 7:07 PM robert engels wrote: > > Not sure the runtime needs it - as all lock usages are known - so the users > in the runtime can ’negotiate’ fairness through other means for a particular > mutex. Yes. The point of starvation mode in sync.Mutex is to avoid high tail

Re: [go-nuts] How to create an object file in elf format from go

2021-01-30 Thread Ian Lance Taylor
On Sat, Jan 30, 2021 at 4:35 PM eafea eaef wrote: > > I'm trying to build my own Fort Rango. > One of the requirements for this project is to not import "C". > If I use the official go compiler with "go tool compile", it will output an > object file in its own format! > I'm wondering if I can

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

2021-01-29 Thread Ian Lance Taylor
On Fri, Jan 29, 2021 at 1:09 PM Ben Burkert wrote: > > I wrote a blog post on my experience updating a package to use the > latest proposed generics feature with the go2go tool. My overall > impression is quite good as it was able to solve some existing > problems with the package. Thanks to Go

Re: [go-nuts] explictly call make new cause space in heap?

2021-01-29 Thread Ian Lance Taylor
On Fri, Jan 29, 2021 at 9:10 AM xie cui wrote: > > when i call make new explictly, does it mean the space must be in heap, in my > mind, it still has chance to alloc in stack in some situation? > my question is is it must be in heap, or in some case it can alloc in stack? The builtin function

Re: [go-nuts] What compatibility of go/ast, go/types, go/packages packages is planned, if any, when transitioning toward go2 ?

2021-01-28 Thread Ian Lance Taylor
On Thu, Jan 28, 2021 at 3:43 AM 'Carla Pfaff' via golang-nuts wrote: > > On Wednesday, 27 January 2021 at 23:28:17 UTC+1 Ian Lance Taylor wrote: >> >> To be clear, there is no Go 2, and there are no plans for Go 2. > > > For someone who follows the mailing lists and i

Re: [go-nuts] calling cmd

2021-01-28 Thread Ian Lance Taylor
On Thu, Jan 28, 2021 at 9:29 AM Jeff Mangan wrote: > > I am trying to get the results of top (more specifically htop) but every > time it prints nothing, whereas any other command (ls, pwd, etc...) returns > the output fine. My objective is to get access to the process stats that are >

Re: [go-nuts] About the confusion caused by type conversion in golang

2021-01-27 Thread Ian Lance Taylor
On Wed, Jan 27, 2021 at 5:13 PM Barry Li wrote: > > Some doubts about type conversion in go. > In the following code, why can it be executed normally after passing the > variable? > The code is an error during the compilation phase. > > // The following two lines of code can be executed normally

Re: [go-nuts] What compatibility of go/ast, go/types, go/packages packages is planned, if any, when transitioning toward go2 ?

2021-01-27 Thread Ian Lance Taylor
On Wed, Jan 27, 2021 at 1:10 PM clément auger wrote: > > I am wondering if some backward compatibility is planned for programs heavily > relying > on ast, parser, type, packages packages to analyze, interpret, manipulate go > source code. > > I read this morning the blog and it says > 'The

Re: [go-nuts] x/image/riff optimisation

2021-01-25 Thread Ian Lance Taylor
On Mon, Jan 25, 2021 at 8:52 AM Alex Crane wrote: > > I have recently been using the x/image/riff library to inspect some large > RIFF files - typically I am interested in all chunks except the data chunk. I > have found with large files the performance is quite poor. Looking into the > code

Re: [go-nuts] Building executable for code with cgo produces link errors

2021-01-21 Thread Ian Lance Taylor
On Thu, Jan 21, 2021 at 10:21 PM Nicholas Yue wrote: > > /* > #include "hello.c" > */ > import "C" Doing a #include of "hello.c" is unusual. That is most likely your problem. The comment before the import "C" is handled as C code. C code rarely does a #include of a .c file. Normally one does

Re: [go-nuts] Building a totally static go binary.

2021-01-20 Thread Ian Lance Taylor
On Wed, Jan 20, 2021 at 8:28 AM Hongyi Zhao wrote: > > On Ubuntu 20.10, I use the following steps to build the go binary: > > $ sudo apt-get build-dep -y golang > $ git clone https://github.com/golang/go.git go.git > $ cd go.git/src > $ ./make.bash > $ cd ../ > $ ldd bin/go > linux-vdso.so.1

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

2021-01-20 Thread Ian Lance Taylor
On Wed, Jan 20, 2021 at 1:19 PM atd...@gmail.com wrote: > > I have been asking because the List of List example seemed a bit contrieved > to me. I have seen maps of linked lists or slice of slices for math stuff but > rarely lists of lists.(probably because of the time complexity) We will have

Re: [go-nuts] Re: Interface arguments to generic functions

2021-01-20 Thread Ian Lance Taylor
On Wed, Jan 20, 2021 at 3:24 AM Brian Candler wrote: > > Yes. Conceptually at least, interfaces defined as type lists could be used > as interfaces: > > type Foo interface { type int32, int64 } > func f(a, b Foo) { > if (a < b) ... > } > > Without specialisation, there would be dynamic

Re: [go-nuts] Re: Interface arguments to generic functions

2021-01-20 Thread Ian Lance Taylor
On Wed, Jan 20, 2021 at 2:08 AM Brian Candler wrote: > > In the Generics proposal, type constraints (other than type lists) take the > form of interfaces. For example, a generic type T may be constrained with > interface C. > > Question: if a function takes type T, does that permit *both*

Re: [go-nuts] Interface arguments to generic functions

2021-01-20 Thread Ian Lance Taylor
On Tue, Jan 19, 2021 at 10:02 PM burak serdar wrote: > > As a generic-function writer, I do not know if the argument will be an > interface or a concrete type. I don't want to check if it is > zero-value, I want to check if it is nil, because I don't want it to > panic. Other people in this

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

2021-01-20 Thread Ian Lance Taylor
On Wed, Jan 20, 2021 at 11:42 AM atd...@gmail.com wrote: > > > It didn't seem to me like proposal-killers enoguh so much so that they might > not have liked some of the design choices they entailed. > > The proble with the current running proposal is that it is a generalization > fo what the

Re: [go-nuts] Interface arguments to generic functions

2021-01-19 Thread Ian Lance Taylor
On Tue, Jan 19, 2021 at 8:41 PM Dan Kortschak wrote: > > On Tue, 2021-01-19 at 19:38 -0800, Ian Lance Taylor wrote: > > On Tue, Jan 19, 2021 at 7:06 PM burak serdar > > wrote: > > > > > > In the following program, it is valid to pass an interface to &g

Re: [go-nuts] Interface arguments to generic functions

2021-01-19 Thread Ian Lance Taylor
On Tue, Jan 19, 2021 at 8:02 PM burak serdar wrote: > > On Tue, Jan 19, 2021 at 8:38 PM Ian Lance Taylor wrote: > > > > On Tue, Jan 19, 2021 at 7:06 PM burak serdar wrote: > > > > > > In the following program, it is valid to pass an interface to function P:

Re: [go-nuts] Interface arguments to generic functions

2021-01-19 Thread Ian Lance Taylor
On Tue, Jan 19, 2021 at 7:06 PM burak serdar wrote: > > In the following program, it is valid to pass an interface to function P: > > func P[T fmt.Stringer](x T) { > fmt.Println(x) > } > > func main() { > var v fmt.Stringer > P(v) > } > > However, there is no way for P to check if x is

Re: [go-nuts] Restrict general type parameter identifiers to be a single uppercase ascii letter.

2021-01-19 Thread Ian Lance Taylor
On Tue, Jan 19, 2021 at 6:33 PM Wojciech S. Czarnecki wrote: > > I'd propose to amend specification so the type parameter identifiers were of > A-Z set, > ie. single uppercase ascii letter. While it is a current convention, it would > be better > to have this convention forced by compiler.

Re: [go-nuts] instead of generics, why cant we just implement an "any" builtin?

2021-01-19 Thread Ian Lance Taylor
On Tue, Jan 19, 2021 at 4:36 AM Kevin Chadwick wrote: > > On 1/19/21 12:21 PM, Axel Wagner wrote: > > And, of course, you can change the suggested syntax again. But every time > > you do > > a change like that, you are flushing the entire previous discussion down the > > drain, because we now

Re: [go-nuts] How to get hold of GOARM at runtime?

2021-01-19 Thread Ian Lance Taylor
On Tue, Jan 19, 2021 at 11:36 AM jan.f...@gmail.com wrote: > > Short question: GOARCH and GOOS is available from the runtime package, but > how do I get hold of the corresponding variable GOARM at runtime? I don't think there is a way to fetch it directly, but you can see it by running "go env

Re: [go-nuts] Workaround for No parameterized methods in go generics draft

2021-01-14 Thread Ian Lance Taylor
On Thu, Jan 14, 2021 at 3:07 PM roger peppe wrote: > > FWIW I think that one possible approach to allowing methods (and potentially > function values) with type parameters might be to allow instantiating them > only with a limited set of "shapes" of data (for example, only pointer-like >

Re: [go-nuts] Workaround for No parameterized methods in go generics draft

2021-01-14 Thread Ian Lance Taylor
On Thu, Jan 14, 2021 at 12:07 PM Marcus Manning wrote: > > On 1/14/21 7:59 PM, Ian Lance Taylor wrote: > > On Thu, Jan 14, 2021 at 4:33 AM Marcus Manning wrote: > >> Hmm..., then we should appreciate the alternative to generate a hidden > >> instance parame

Re: [go-nuts] Workaround for No parameterized methods in go generics draft

2021-01-14 Thread Ian Lance Taylor
On Thu, Jan 14, 2021 at 4:33 AM Marcus Manning wrote: > > Hmm..., then we should appreciate the alternative to generate a hidden > instance parameter for each instantiated type in the function body. The > hidden parameters might need to be up-propagated. Further, using > reflection, these hidden

Re: [go-nuts] how linker decide addr of sym in a circle call?

2021-01-13 Thread Ian Lance Taylor
On Wed, Jan 13, 2021 at 7:39 AM xie cui wrote: > > in linker, > the code is like this: > > func f() { >g() > } > > func g() { > f() > } > when gen binary code of func f, need func g, and gen g need f, > how linker deal with this situation, and where is the code? > is dynrelocsym do this

Re: [go-nuts] Generics security discussion.

2021-01-13 Thread Ian Lance Taylor
On Wed, Jan 13, 2021 at 6:38 AM Kevin Chadwick wrote: > > On 1/13/21 2:09 PM, Axel Wagner wrote: > > Let me repeat my question: Do you have any concrete reason to assume there > > is a > > negative security impact of generics? Feel free to bring that up. > > Otherwise, I > > don't see a reason

Re: [go-nuts] Workaround for No parameterized methods in go generics draft

2021-01-13 Thread Ian Lance Taylor
On Wed, Jan 13, 2021 at 12:39 PM Marcus Manning wrote: > > Does reflection support generic instantiation? No. In the current proposal, generic functions and types are not visible at run time. Only instantiated functions and types are visible. So there is no way to even name a generic

Re: [go-nuts] Creating a serde-like framework for Go using generics?

2021-01-12 Thread Ian Lance Taylor
On Tue, Jan 12, 2021 at 12:29 PM Keith Wipf wrote: > > Also, will Go generics support specialization? I thought that I saw > somewhere that you would be able to switch on a type parameter at > compile time. I'm thinking you'd need this to serialize ints and other > primitive types because you

Re: [go-nuts] Using go tool with third-party Go implementations

2021-01-11 Thread Ian Lance Taylor
On Mon, Jan 11, 2021 at 11:03 AM Alexander Zhirov wrote: > > At the moment there are at least three alternative implementations of Go that > I know of (and there are probably some I don't): gccgo, tinygo and gopherjs. > Of the three, only gccgo is supported by the go tool out of box. Looking at

Re: [go-nuts] Generics and formatting

2021-01-05 Thread Ian Lance Taylor
On Tue, Jan 5, 2021 at 8:11 AM Brian Candler wrote: > > I don't know if this is expected, but this (bad) program causes the go2go > playground to give "panic: assertion failed" > > https://go2goplay.golang.org/p/VH5SLJNxw3X > > - I think it's the compiler itself that's panicing, not the runtime

Re: [go-nuts] Generics and constraints question

2021-01-05 Thread Ian Lance Taylor
This definitely needs a better error message. Ian On Tue, Jan 5, 2021 at 12:27 PM roger peppe wrote: > > You can do this with type-list interfaces: > https://go2goplay.golang.org/p/wfHnVHOMcyK > > This is one of the harder parts of the proposal to understand IMHO, but > perhaps it will

Re: [go-nuts] Generics and formatting

2021-01-02 Thread Ian Lance Taylor
On Sat, Jan 2, 2021 at 10:28 AM 'Brian Candler' via golang-nuts wrote: > > Raised as https://github.com/golang/go/issues/43470 Thanks. Ian > On Friday, 1 January 2021 at 18:40:36 UTC Ian Lance Taylor wrote: >> >> On Fri, Jan 1, 2021 at 9:50 AM 'Brian Candler' via

Re: [go-nuts] Generics Error - How to fix?

2021-01-01 Thread Ian Lance Taylor
On Fri, Jan 1, 2021 at 12:52 PM da...@suarezhouse.net wrote: > > Wow, you are awesome! I think this shows that generics "can be" fully hidden > from view of typical users if desired. In other words, the typical user > wouldn't need to know they exist whereas more advanced users can leverage

Re: [go-nuts] Generics - please provide real life problems

2021-01-01 Thread Ian Lance Taylor
On Fri, Jan 1, 2021 at 12:40 PM robert engels wrote: > > I was thinking more of an internal api - maybe stdlib authors only - writing > code similar to map.go to create an alternate map type, and allow selecting > of that map type in the make() call. It would be more difficult to write the >

Re: [go-nuts] Generics - please provide real life problems

2021-01-01 Thread Ian Lance Taylor
On Fri, Jan 1, 2021 at 10:25 AM robert engels wrote: > > To Ian’s point, what if I could declare a map that had the semantics of a > concurrent hash map without adding generics? I think something like this > gives Go a leg up, rather than just making it “closer to Java” as some > complain.

Re: [go-nuts] Generics and formatting

2021-01-01 Thread Ian Lance Taylor
On Fri, Jan 1, 2021 at 9:50 AM 'Brian Candler' via golang-nuts wrote: > > Just a minor issue, but playing with this example: > https://go2goplay.golang.org/p/IUL1QDrtOwW > - click "Run" and it works > - click "Format" and it fails with the following error: > > prog.go:40:24: expected ']', found

Re: [go-nuts] how linker work?

2021-01-01 Thread Ian Lance Taylor
On Fri, Jan 1, 2021 at 7:49 AM xie cui wrote: > > in my mind, the main job of linker is to resolve symbols between .a files, is > the right? > my question: > there a func named foo def in a.a, and there a func named bar in b.a, > bar will call foo, > before link the two file, i think in

Re: [go-nuts] Generics - please provide real life problems

2020-12-31 Thread Ian Lance Taylor
On Thu, Dec 31, 2020 at 5:42 AM Kevin Chadwick wrote: > > On 12/30/20 6:38 PM, Ian Lance Taylor wrote: > > I don't think this is accurate. Surveys express a clear and > > consistent desire for generics that is far ahead of requests for > > operator overloading or

Re: [go-nuts] Generics - please provide real life problems

2020-12-31 Thread Ian Lance Taylor
On Thu, Dec 31, 2020 at 4:56 AM Space A. wrote: > > ok, so please read it finally and tell which point exactly you think was > against CoC and in what of my messages and in which exact thread, but do not > put my words out of context. And explain why you responded just now, and to > my message

Re: [go-nuts] Signature Switch - third path to Go generics

2020-12-31 Thread Ian Lance Taylor
On Thu, Dec 31, 2020 at 10:37 AM Wojciech S. Czarnecki wrote: > > I regard current Team's proposal a way better than the first iteration. But - > while I see a need for generic way to write common code, I also share > concerns about readability and future abuse of the materialized Go generics >

Re: [go-nuts] would linker do some lto work? what kind of lto work it would do?

2020-12-30 Thread Ian Lance Taylor
On Wed, Dec 30, 2020 at 6:52 AM xie cui wrote: > > would linker do some lto work? what kind of lto work it would do? Because Go uses explicit package imports, and because imports may not have cycles, a lot of work that can only be done at link time for C-like languages can be done at compile

Re: [go-nuts] Generics - please provide real life problems

2020-12-30 Thread Ian Lance Taylor
On Wed, Dec 30, 2020 at 6:38 AM Jan Mercl <0xj...@gmail.com> wrote: > > FTR: Popular vote also demands exceptions or hidden execution control > for errors, operator overloading and other things that IMO Go avoided > intentionally. Because there's no good reason to have just yet another >

Re: [go-nuts] Runtime cost of type assertions

2020-12-30 Thread Ian Lance Taylor
On Wed, Dec 30, 2020 at 9:52 AM Arnaud Delobelle wrote: > > Thanks for the explanations. Given reflect and the plugin mechanism, it > seems like compile time analysis is not a very attractive option. It is a > shame in my case because I really feel like using an interface is the natural >

Re: [go-nuts] A new solution of type list in generic.

2020-12-28 Thread Ian Lance Taylor
te nervous about implicit type conversion. It makes it very easy to get confused about what type you have and how that type changes. That is why Go has very little implicit type conversion. Ian > On Tuesday, December 29, 2020 at 1:35:37 AM UTC+8 Ian Lance Taylor wrote: >> >> On Mon

Re: [go-nuts] Possible language improvement re multiple assignment

2020-12-28 Thread Ian Lance Taylor
On Mon, Dec 28, 2020 at 11:40 AM bobj...@gmail.com wrote: > > For the case of multiple variable assignment where some of the target > variables are to be created in the local scope and some are to be found in > the existing scope... > > Allow: > > existingVar, :newVar = 1, 2 > > instead of: >

Re: [go-nuts] A new solution of type list in generic.

2020-12-28 Thread Ian Lance Taylor
On Mon, Dec 28, 2020 at 3:30 AM redsto...@gmail.com wrote: > > If generic is inevitable, make it better. The type list in the current draft > is so special that it is added only for operators. I think it will bring > complexity and inconsistens in go. So I get an idea to replace it. > > type

Re: [go-nuts] Import a submodule from its parent package?

2020-12-27 Thread Ian Lance Taylor
On Sun, Dec 27, 2020 at 6:42 PM Aidan Hahn wrote: > > I am writing a modification to the os package in which I would like to take > advantage of code from the os/signal package. Ive written the patch (modified > os/exec_posix.go) and as I expected none of the symbols from os/signal are >

[go-nuts] Re: Generics - please provide real life problems

2020-12-24 Thread Ian Lance Taylor
On Thu, Dec 24, 2020 at 6:39 AM Martin Hanson wrote: > > @Ian Lance Taylor, I feel I must apologize to you. I have just hunted > down every single mailing list post from you regarding the generics > issues and I have found that you have been extremely balanced and very > much pr

Re: [go-nuts] [generics] use of new predeclared name `any`

2020-12-24 Thread Ian Lance Taylor
On Thu, Dec 24, 2020 at 4:04 AM LeoY wrote: > > Thank you, Ian. Is there any desire to avoid introducing a new predefined > name? Is it going to be just an empty interface definition in one of the core > language modules similar to the following: > > type any interface { } > > If this is a case

Re: [go-nuts] Generics - please provide real life problems

2020-12-23 Thread Ian Lance Taylor
On Wed, Dec 23, 2020 at 10:15 PM Martin Hanson wrote: > > I have been arguing passionately against adding generics to Go because > I truly believe that it is going against the simplicity of Go and the > philosophy behind the design of Go. > > I believe that the resilience of Go against

Re: [go-nuts] Looking for a Go-Lang Developer

2020-12-23 Thread Ian Lance Taylor
On Wed, Dec 23, 2020 at 9:13 PM Matt Harden wrote: > > Since Go version 1.0 was not released until March 2012, you might find it > hard to find people with 10 years of experience with it. There are dozens of us! DOZENS! Ian > On Wed, Dec 23, 2020 at 1:07 PM Kavya S wrote: >> >> Hi

Re: [go-nuts] [generics] Print[T Stringer](s []T) vs Print(s []Stringer)

2020-12-23 Thread Ian Lance Taylor
On Wed, Dec 23, 2020 at 9:54 AM wilk wrote: > > https://go2goplay.golang.org/p/fTW3hJYNgfU > > type Stringer interface { >String() string > } > > Print[T Stringer](s []T) > > Print(s []Stringer) > > Both forms works. > How to prevent double way to do the same things that can be confusing ?

Re: [go-nuts] [generics] use of new predeclared name `any`

2020-12-23 Thread Ian Lance Taylor
On Wed, Dec 23, 2020 at 9:03 AM LeoY wrote: > > Following the blog post about generics in Go, I want to join Ian about his > claim to "Minimize new concepts". > Would it be possible to allow a syntax that just omits a type constraint in > the generic function definition instead of using any ?

Re: [go-nuts] how to pass the following compiler/linker flags using -gccgoflags build flag

2020-12-22 Thread Ian Lance Taylor
On Tue, Dec 22, 2020 at 10:30 PM Yonatan Gizachew wrote: > > I want to pass the '-Wl,--split-stack-adjust-size=0x8000' to the gold linker > as follows: > > go build -o libgotest.so -buildmode=c-shared -compiler=gccgo > -gccgoflags='-Wl,--split-stack-adjust-size=0x8000' test_mmap.go > But there

Re: [go-nuts] Re: Generics, please go away!

2020-12-22 Thread Ian Lance Taylor
On Tue, Dec 22, 2020 at 2:09 PM Martin Hanson wrote: > > @Ian, if you're succumbing to outside pressure, please don't. > > If you on the other hand is pro-generics to Go, then of course that is > your right. > > I for one doesn't hope that the future of Go is going to continue down > this road,

Re: [go-nuts] Re: Generics, please go away!

2020-12-22 Thread Ian Lance Taylor
On Tue, Dec 22, 2020 at 1:57 PM Martin Hanson wrote: > > > He did explicitly said in the last paragraph that Go is not driven by > > pools (aka surveys). > > Please re-read! > > The problem is that his post is quite contradictory. On the one hand he > states that "Go is not and never has been a

Re: [go-nuts] Re: Generics, please go away!

2020-12-22 Thread Ian Lance Taylor
On Tue, Dec 22, 2020 at 1:46 PM Martin Hanson wrote: > > > I don't know of a poll specifically about generics. But for the past > > several years we've done a Go community survey, and every year there > > is significant support for adding generics to the language. > > So Ian, what you're saying

Re: [go-nuts] Re: Generics, please go away!

2020-12-22 Thread Ian Lance Taylor
On Tue, Dec 22, 2020 at 1:24 AM Markus Heukelom wrote: > > Why not issue a poll on generics, was this ever done? (I could've missed it, > I am only following Go ~2 years). While the community has a vote in > accepting/rejecting the current generics proposal, the community was never > (really)

Re: [go-nuts] Re: 1.16 beta 1 - Getting an error trying to use the "embed" package

2020-12-18 Thread Ian Lance Taylor
On Fri, Dec 18, 2020 at 4:50 AM Amit Saha wrote: > > On Fri, 18 Dec 2020, 11:44 pm Volker Dobler, > wrote: >> >> Use >> >> import _ "embed" // note the _ >> >> Your code does not use package embed. A comment does >> not qualify as usage. As yous must import it for //go:embed >> comments

Re: [go-nuts] Building Go On Unsupported Platform (FreeBSD/PowerPC64)

2020-12-17 Thread Ian Lance Taylor
On Thu, Dec 17, 2020 at 5:37 PM Curtis Hamilton wrote: > > I know that my platform is not supported. However, I've been successful in > patching and building working go v1.13 on my Raptor Blackbird (Power9) > running FreeBSD v12.1. I'm also able to build versions 1.14 and 1.15 as well. > > I

Re: [go-nuts] Re: Is this really true? (Go 'unable to reliably change their UID once started for goroutines' ?)

2020-12-16 Thread Ian Lance Taylor
On Wed, Dec 16, 2020 at 5:11 AM Kevin Chadwick wrote: > > >> It is very important to be aware that programs written in Go are unable to > >> reliably change their UID once started, due to how goroutines are > >> implemented > >> on unix systems. As an unavoidable consequence of this, CGI

Re: [go-nuts] How to set the "godebug" environment variable from the go file?

2020-12-16 Thread Ian Lance Taylor
On Wed, Dec 16, 2020 at 8:49 AM Sean wrote: > > hi all, > i have a project I have to work with CGo. I want to disable some > controls as they are not good enough right now. > It works when I write "set godebug=cgocheck=0" on Windows in console. > However, this is a GUI program. Console should not

Re: [go-nuts] want to add a new wiki page

2020-12-13 Thread Ian Lance Taylor
On Sun, Dec 13, 2020 at 12:09 PM Naoki Kaneko wrote: > > I’m thinking about translating effective go into my local language. > But there is not document on editing wiki on https://github.com/golang/go > Do you know what procedure should I take to the contribution? There is no particular

Re: [go-nuts] Go's scheduler, the GMP model. Will the M busy waiting?

2020-12-09 Thread Ian Lance Taylor
On Wed, Dec 9, 2020 at 9:44 AM 黎波 wrote: > > Inside the Go's scheduler, what will happen when an M that already has P > attached cannot find a G both from local runqueue (include trying to steal > from other P's) and global runqueue. > > Will the M keep trying in a busy waiting manner? If so,

Re: [go-nuts] what is these code line for?

2020-12-08 Thread Ian Lance Taylor
On Tue, Dec 8, 2020 at 11:11 PM xie cui wrote: > > https://github.com/golang/go/blob/master/src/runtime/proc.go#L248-L251 > why these codes, it seem is unnecessary? Those lines are there to help new ports. If the `exit` function isn't working right, it might return. If the signal handler isn't

Re: [go-nuts] on 'while'

2020-12-07 Thread Ian Lance Taylor
On Mon, Dec 7, 2020 at 11:18 AM Oliver Smith wrote: > > Recognizing this is likely to be a dead horse already flogged to infinity, > I've been unsuccessful trying to find discussions on the topic of why while > was nixed in-favor of the more verbose and error-prone for-based > implementations,

Re: [go-nuts] Re: draft designs for file system interfaces & file embedding

2020-11-28 Thread Ian Lance Taylor
On Sat, Nov 28, 2020 at 10:27 AM Constantine Vassilev wrote: > > I would like to test it. How to install the go 1.16 tip version? See https://golang.org/doc/install/source . Ian -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe

Re: [go-nuts] Estimating blockers for supporting gollvm on RISC-V (qemu). Fedora 33

2020-11-28 Thread Ian Lance Taylor
On Sat, Nov 28, 2020 at 12:40 AM Ivan Serdyuk wrote: > > Jim, > adding you to the discussion. > > I was not able to build gold, by configuring binutils, using >> >> ./configure --enable-gold > > did not allow GNU make tool to build gold: many sub-directories were > processed, to compile the

Re: [go-nuts] History & origins of the Go memory model

2020-11-27 Thread Ian Lance Taylor
On Fri, Nov 27, 2020 at 12:57 PM Daniel Fava wrote: > > Does anyone know how the Go memory model came to be? I don't have technical > questions about it. I just would like to know the historical context. > > The model is specified in terms of happens-before, due to Lamport. But the >

Re: [go-nuts] Do we document the history of .gosymtab and .gopclntab, and the differences with .symtab and .debug_line, .debug_frame?

2020-11-26 Thread Ian Lance Taylor
On Thu, Nov 26, 2020 at 11:50 AM Kn wrote: > > Hi, I am writing a golang debugger and some documents to show others the > knowledge about how to develop a golang debugger. > > I notice go debug/elf, debug/gosym is enough for the occasions like lookup > symbol, pcToLn, lnToPC, maybe even for

Re: [go-nuts] concurrency safety

2020-11-25 Thread Ian Lance Taylor
On Wed, Nov 25, 2020 at 6:13 PM Alexey Dvoretskiy wrote: > > How would you cal "thread-safety" in Go? Go doesn't have threads so the term > "thread-safety" sounds bit off. The standard library says things like "Multiple goroutines may invoke methods on a Conn simultaneously" (from

Re: [go-nuts] error handling proposals summary

2020-11-25 Thread Ian Lance Taylor
On Wed, Nov 25, 2020 at 3:10 PM seank...@gmail.com wrote: > > For some reason I thought going through most of the error handling proposals > would be a nice way to spend the evening (note I now mostly regret this). If > anyone wants to see how similar they are: >

Re: [go-nuts] Estimating blockers for supporting gollvm on RISC-V (qemu). Fedora 33

2020-11-24 Thread Ian Lance Taylor
On Tue, Nov 24, 2020 at 6:14 AM Richard W.M. Jones wrote: > > One thing I'm missing: Why does golang need gold? The gccgo and GoLLVM compilers (which are not the most widely used Go compilers) require the gold linker for full support of stack splitting. Stack splitting is used to ensure that

Re: [go-nuts] Confused by test case of `singleflight`

2020-11-23 Thread Ian Lance Taylor
On Mon, Nov 23, 2020 at 6:05 AM 叶志辉 wrote: > > A little confused by the test case of `singleflight` of > `internal/singleflight`. > > Which is the codes singleflight. > > 1. wg1 > > Purpose for wg1 is as commented as: > > // At least one goroutine is in fn now and all of them have at > // least

Re: [go-nuts] Re: Local variable escapes to heap

2020-11-21 Thread Ian Lance Taylor
On Sat, Nov 21, 2020 at 12:11 AM jfcg...@gmail.com wrote: > > I have the following: > > package myf > > func F1(x *int, ch chan bool) { > *x += 1 > ch <- false > } > > func F2() { > var x int > ch := make(chan bool) // or with buffer > go F1(, ch) > <-ch > } > > I get this

Re: [go-nuts] [generics] generic types join through pipes

2020-11-20 Thread Ian Lance Taylor
On Fri, Nov 20, 2020 at 2:58 PM Reindert Vetter wrote: > > First of all, thank you for everything you do with Go! > > I've had an idea for generic for Go for some time. If it makes no sense, > please ignore my email. > > The idea is to join the different types through a pipe. This means you do

Re: [go-nuts] Alignment requirements for 64-bit atomics on 386

2020-11-20 Thread Ian Lance Taylor
r sure. Honestly I don't think it was your mistake. I think the docs are confusing. I think we should change the docs to say "i386", since that is what we use for a GOARCH value. I will do that if nobody beats me to it. Ian > On Friday, November 20, 2020 at 1:54:28 PM

Re: [go-nuts] Alignment requirements for 64-bit atomics on 386

2020-11-20 Thread Ian Lance Taylor
On Fri, Nov 20, 2020 at 12:48 PM 'Kevin Chowski' via golang-nuts wrote: > > I am debugging an issue in which we are seeing a crash on an atomic access; > on go 1.14.7 and 1.15.2 this reproduces with the following error: > > > panic: runtime error: invalid memory address or nil pointer

Re: [go-nuts] Ballooning Executable Sizes

2020-11-19 Thread Ian Lance Taylor
On Thu, Nov 19, 2020 at 11:34 AM stephen.t@gmail.com wrote: > > I have a reasonably sized project that produces executables that have > ballooned in size between two relatively simple commits. > > I've tested with three compiler versions and in each case the executable size > is

Re: [go-nuts] i can't use defer c.free to release the cgo.cstring memory when my func return the cstring

2020-11-17 Thread Ian Lance Taylor
On Tue, Nov 17, 2020 at 6:38 PM 杜仲 wrote: > > my go version is 1.13. > i used cgo.cstring in my func, and the func will return cstring. > i don't know when c complete work about the cstring memory. > if i used defer c.free to release the cstring memory, the cstring val will > change and return a

Re: [go-nuts] gollvm: Issues on Alpine linux. Tentative definition has type 'struct sigstack' that is never completed, in sysinfo.c

2020-11-17 Thread Ian Lance Taylor
On Tue, Nov 17, 2020 at 6:11 AM Than McIntosh wrote: > > > /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/sysinfo.c:462:1: > > error: tentative definition has type 'struct sigstack' that is never > > completed > > SREF(sigstack); > > ^ > > I don't know why sysinfo.c

Re: [go-nuts] Making syscalls in the syscall package

2020-11-17 Thread Ian Lance Taylor
On Tue, Nov 17, 2020 at 8:20 AM Aidan Hahn wrote: > > I am currently patching my local go runtime to fix a bug it has. I would like > to make the signal() syscall, or at least the sigaction() syscall from inside > the syscall package but it looks like those functions are defined as private >

Re: [go-nuts] Minisign for x/crypto

2020-11-17 Thread Ian Lance Taylor
[ + Filippo ] On Tue, Nov 17, 2020 at 12:56 PM 'Péter Szilágyi' via golang-nuts wrote: > > Hey all, > > This is just a quick question whether the Go maintainers would be > interested in a package contribution to `x/crypto` to implement minisign? > https://jedisct1.github.io/minisign/ > >

<    4   5   6   7   8   9   10   11   12   13   >