Hacker News new | ask | show | jobs
by gowld 1892 days ago
I think the way to say it is that Go requires you to declare every allocation, but allows over-declaration in the case of copying.

> := [...] an error to use it when it doesn't allocate.

> := [...] not allocating if you have a variable on the left that is already allocated,

This appears to be a contradiction.

I suppose you mean something like "error to use it when there's no possible context where that line of code would allocate"; what's an example of that?

1 comments

a, b := 1, 2

If either a or b (but not both) were already defined, this won't re-define (and reallocate space for) them.

Aha, lossy compression syntax!