On Mon, Jul 25, 2016 at 10:40 AM, Matt Harden <matt.har...@gmail.com> wrote: > The syntax is &type{...}. &42 does not match this syntax. What Jan was > describing is specific to that syntax, not to the use of & in general; in > fact let's try it for &x: > > tmp := x > &tmp > > This gives a very different and not useful value for &x. &T{...} is an > exceptional syntactic sugar for grabbing the address of a compound value. It > doesn't make much sense to generalize this syntactic sugar to other values.
As I recall, at one point before the public release of Go Russ made a pitch for changing &T{} to (*T){} as that would be more consistent: just as T{} creates a value of type T, (*T){} would create a value of type *T. But even though it was more consistent nobody really liked it and we stuck with the &T{} syntactic sugar. Ian -- 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. For more options, visit https://groups.google.com/d/optout.