alokjha / go-tour

Automatically exported from code.google.com/p/go-tour
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Why are there square brackets here?I would have assumed that "[]it" means "an int pointer," and... #65

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
https://feedback.corp.google.com/#/Report/1001186954

Description:
Why are there square brackets here?

I would have assumed that "[]int" means "an int pointer," and that "make([]int, 
5)" would return an array of five int pointers.

It seems like the logical syntax for "making" an array of ints would be 
"make(int, 5)."

What's the rationale for this seemingly wonky syntax?  This needs to be 
explained.

Description translated:
Why are there square brackets here?

I would have assumed that "[]it" means "an int pointer," and that "make([]it, 
5)" would return an array of five int pointers.

It seems like the logical syntax for "making" an array of ints would be 
"make(int, 5)."

What's the rationale for this seemingly wonky syntax?  This needs to be 
explained.

UI language: en
Detected language: en

Original issue reported on code.google.com by feedback...@gmail.com on 3 Jul 2013 at 6:44

GoogleCodeExporter commented 8 years ago
I think you're thinking like a C programmer. make takes the type to be made. 
Keep going, it'll make sense.

Unless you can suggest different wording?

Original comment by a...@golang.org on 4 Jul 2013 at 10:17