I'd much rather have syntax that just works rather than another built-in
function.

On Sat, Oct 22, 2016, 6:17 PM roger peppe <rogpe...@gmail.com> wrote:

> When I need to do this, I find it's only a very minor annoyance to define:
>
>     func newInt(i int) { return &i }
>
> If Go ever got generics, this would probably be trivial to write
> generically, for example:
>
>     func Ref[T](x T) *T { return &x }
>
> I don't think I'd object if we added a new builtin function called "ref"
> with the above semantics. It worked pretty well in Limbo as an operator.
>
> On 21 Oct 2016 22:44, "Nate Finch" <nate.fi...@gmail.com> wrote:
>
> Perhaps regular was the wrong choice of phrasing.  From an end-user's
> perspective, it makes the language more consistent, rather than having
> &T{v} work for some of the more complex values of T, but not for the more
> simple values of T.
>
> On Fri, Oct 21, 2016 at 3:59 PM Jan Mercl <0xj...@gmail.com> wrote:
>
> On Fri, Oct 21, 2016 at 9:20 PM Nate Finch <nate.fi...@gmail.com> wrote:
>
> > And, I would argue, it actually makes the language slightly more
> regular, since now &T{v} works for just about everything (possibly
> everything?).
>
> Taking the address of an addressable thing is the regular proper. Taking
> address of a non-addressable things, even though practical, is syntactic
> sugar. Enlarging the surface of the later irregularity cannot make anything
> more regular.
>
> --
>
> -j
>
> --
>
> 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.
>
>

-- 
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.

Reply via email to