Name before type: why ‘age int’ is better than ‘int age’
benhoyt.com
benhoyt.com
but whether a type is before or after the name of a variable? Come one man.,,
The decision has a lot of important second-order effects, and a lot of people are heavily invested in denying that because they are more familiar with "Type name".
Jumpy Dart:
(String, int) userInfo(Map<String, dynamic> json)
int userAge(String name)
Regular Swift: func userInfo(_ json: Dictionary<String, Any>) -> (String, Int)
func userAge(_ name: String) -> Int int* x, y;
Whereas the equivalent in Go does what you’d expect, declaring both to be pointers: var x, y *int
”*I don’t see how that’s an argument in favour of `age int` over `int age`. Both C could easily have picked the alternative semantics. Go could have, too:
var x*, y* int; // two pointers
var x, y* int; // x is an int, y a pointer to int
or var *x, *y int; // two pointers
var x, *y int; // x is an int, y a pointer to int