Re: [go-nuts] Could the go Tour be clearer on WHY recent make := zeroes
On 6/21/19 10:42 AM, fge...@gmail.com wrote: > (I forgot in my previous message: the email subject seems to imply > that := or make() was changed since 1.0. No it wasn't.) That was simply based on this, perhaps prior to 1.0?: "https://groups.google.com/forum/#!searchin/golang-nuts/make$20new$20zeroed|sort:date/golang-nuts/793ZF_yeqbk/norrWEAyVTcJ" "we have both make and new mainly for pragmatic reasons. new(T) returns *T. so it can't return chan int, which doesn't have the form *T. so another operator is needed. for a short time, we tried getting by with just make, and make(*T) was like new(T) is today. people found it too surprising coming from c, c++, and java. russ" On reflection, I guess the subject line is inaccurate. When I find the time I will suggest a patch for the tour. I Just wondered if it may be a cause of list noise, but probably not. I just created noise instead, ;) Regards, KC -- 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 it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/d16e3c5b-8b63-7fdc-9079-1907295c4244%40gmail.com. For more options, visit https://groups.google.com/d/optout.
Re: [go-nuts] Could the go Tour be clearer on WHY recent make := zeroes
(I forgot in my previous message: the email subject seems to imply that := or make() was changed since 1.0. No it wasn't.) This for later reference: new and make and initialization is very easy to parse in the faq in the spec and in the effective go document: https://golang.org/doc/faq#new_and_make I'm not sure about the tour recommendation change, if you are curious I recommend you to file an issue, to see what others with commit rights think about the change. On 6/20/19, Kevin Chadwick wrote: > On 6/20/19 8:30 PM, fge...@gmail.com wrote: >> I'm not sure what you are asking for, but >> the spec on initialization is quite clear: >> https://golang.org/ref/spec#The_zero_value >> >> I'm curious which detailed literature are you referring to? > > I was prompted by atleast a couple of books but also the spec. > > Indeed the spec is clearer than I realised, had I clicked through on the > link > you sent "initial values", here. > > https://golang.org/ref/spec#Allocation > > Perhaps the tour could link to that section of the spec? > > https://tour.golang.org/moretypes/13 > > "allocates a zeroed array" -> "https://golang.org/ref/spec#The_zero_value; > > -- > 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 it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/982d264d-0e52-ad9e-775b-55172f06d29d%40gmail.com. > For more options, visit https://groups.google.com/d/optout. > -- 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 it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CA%2Bctqrr%2BSYd5rSg%3DF9PgG1oZeejzyNNG90xovRDuLb%2BUSnDRKQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
Re: [go-nuts] Could the go Tour be clearer on WHY recent make := zeroes
On 6/20/19 8:30 PM, fge...@gmail.com wrote: > I'm not sure what you are asking for, but > the spec on initialization is quite clear: > https://golang.org/ref/spec#The_zero_value > > I'm curious which detailed literature are you referring to? I was prompted by atleast a couple of books but also the spec. Indeed the spec is clearer than I realised, had I clicked through on the link you sent "initial values", here. https://golang.org/ref/spec#Allocation Perhaps the tour could link to that section of the spec? https://tour.golang.org/moretypes/13 "allocates a zeroed array" -> "https://golang.org/ref/spec#The_zero_value; -- 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 it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/982d264d-0e52-ad9e-775b-55172f06d29d%40gmail.com. For more options, visit https://groups.google.com/d/optout.
Re: [go-nuts] Could the go Tour be clearer on WHY recent make := zeroes
On Thu, Jun 20, 2019, 18:56 Kevin Chadwick wrote: > Hi > > "https://tour.golang.org/moretypes/13; > > "The make function allocates a zeroed array and returns a slice that > refers to > that array." > > Yet more detailed literature states that make does not zero whilst new > does. > > I gather this is because the shorthand used in the tour, instantiates new > in the > background and wants to be as simple as possible for new users? > > I am not sure if that is actually most helpful. To avoid confusion, should > it be > something like: > > The shorthand make := syntax allocates a zeroed array (akin to > automatically > invoking new) and returns a slice that refers to that array? > > Regards, Kc > > -- > 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 it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/e045f1c3-782f-f733-73a0-16eccf908ef4%40gmail.com > . > For more options, visit https://groups.google.com/d/optout. > I'm not sure what you are asking for, but the spec on initialization is quite clear: https://golang.org/ref/spec#The_zero_value I'm curious which detailed literature are you referring to? > -- 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 it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CA%2Bctqrr%3D5ThmWXBMTiprWpUwA9Rjs8SV%2BT_U83OYkQmPtBnj%2BQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
[go-nuts] Could the go Tour be clearer on WHY recent make := zeroes
Hi "https://tour.golang.org/moretypes/13; "The make function allocates a zeroed array and returns a slice that refers to that array." Yet more detailed literature states that make does not zero whilst new does. I gather this is because the shorthand used in the tour, instantiates new in the background and wants to be as simple as possible for new users? I am not sure if that is actually most helpful. To avoid confusion, should it be something like: The shorthand make := syntax allocates a zeroed array (akin to automatically invoking new) and returns a slice that refers to that array? Regards, Kc -- 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 it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/e045f1c3-782f-f733-73a0-16eccf908ef4%40gmail.com. For more options, visit https://groups.google.com/d/optout.