3 ms·
> Go fixes C's well-understood flaws (declaration resembling use This seems to be a common belief, but since Go kept pointer syntax as prefix, you're still stu
by xscott 6y ago
> Go fixes C's well-understood flaws (declaration resembling use
This seems to be a common belief, but since Go kept pointer syntax as prefix, you're still stuck needing parens in some unfortunate cases:
https://blog.golang.org/declaration-syntax https://blog.golang.org/declaration-syntax (see the part about pointers near the bottom)
As Rob Pike writes in that link, they could've fixed it and still had declaration resembling use if they had chosen a suffix operator for pointers. He notes that Pascal uses ^, but it seems like @ might be a better choice:
int foo // an integer
int foo@ // pointer to int
int foo[10]@ // 10 pointers
int foo@[10] // pointer to array
int foo()[10]@ // function that returns an array of 10 pointers
In my opinion, they almost fixed it and then punted. As such, it's just different, but not really better.