On Thu, Nov 12, 2009 at 5:32 PM, xx <x...@xx.com> wrote:
>> In Go (from what I understand), a struct is stack allocated with
>>    x := Struct();
>> and heap allocated with
>>    x := &Struct();
>
> It's a nice trick, but I don't find it intuitive. Getting address of an 
> object (re)allocates it? Literal that has different address each time?

I look at it more as taking the address of the type, which is
currently meaningless, then passing that some constructor args.

But good point... the syntax is ambiguous with taking the address of
the constructed value literal.
I guess that would force you to add a new precendence rule.  So to
actually take the address you'd need &(Struct()).

I like it less now.

--bb

Reply via email to