3 ms·
I'm puzzled about the asymmetry of the syntax. What's the reason behind map[Point]string as opposed to something more symmetrical?
by zak_mc_kracken 11y ago
I'm puzzled about the asymmetry of the syntax. What's the reason behind
map[Point]string
as opposed to something more symmetrical?
- DrJokepu 11y agoIt makes sense if you're used to Go. In Go, in function declarations return types come after the argument list, e.g: func doSomething(input string) string { ... } The go map declaration syntax is analogous to the function declaration syntax: the keyword (map, analogous to the func keyword) followed by the type of the keys in brackets (analogous to the argument type in parentheses) followed by the type of the values (analogous to the return type).
- socceroos 11y agoI've never seen that explained so succinctly. Thank you.
- aikah 11y agomakes little sense but since go doesn't have user defined parametric types, it makes no difference. Now I wish I had 1 million dollars and a better brain to work full time on a proper language that would fix go's issues. What a missed opportunity to create something everybody would be comfortable with. It could have been the biggest language of the next 20 years in webdev, CSP is a great concurrency model. At least it will inspire some people in the future I hope. Rust is cool but doesn't have CSP builtin.
- enneff 11y ago> something everybody would be comfortable with Not possible.