Go updates
Norbert Nemec
Norbert at Nemec-online.de
Tue Mar 23 22:41:35 PDT 2010
bearophile wrote:
> This Go syntax is cute:
> Pointer to int: *int
> Array of ints: []int
> Array of pointer to ints: []*int
> Pointer to array of ints: *[]int
>
> In D it becomes:
> Pointer to int: int*
> Array of ints: int[]
> Array of pointer to ints: int*[]
> Pointer to array of ints: int[]*
>
> Here I think I like the Go version better :-(
The famous case in support of Go syntax:
In D syntax, a nested array
int[A][B] x;
has to be indexed as
x[b][a]
(implying that b runs over 0..B and a over 0..A)
After all, it is an "array of B arrays of A integers", in other words an
"integer-A-element-array-B-element-array".
The same in Go ordering is more straightforward:
[B][A]int x
More information about the Digitalmars-d
mailing list