4 ms·
Name before type: why ‘age int’ is better than ‘int age’
- Slashbot3 3y agotype name ....is better, any other arrangement including adding stupid symbols like : ...is just retarded alot of retarded people around these days alot of them took the vax.. because they are retarded.
- dchest 3y agoAnother example. 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
- Someone 3y agoFTA: “In C, the following declares x to be a pointer, but (surprisingly at first!) y to be a normal integer: 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
- rowanG077 3y agoHonestly I really don't get people who are obsessed with this. Static vs dynamic? That matters A LOT! Error handling style? Very important. Expression based vs statement based? Now you are talking. but whether a type is before or after the name of a variable? Come one man.,,
- benhoyt 3y agoAre people "obsessed" with this? As the OP, I'm not. I agree with you that static vs dynamic typing and the other issues you mentioned are more important than this, but that doesn't make smaller details not worth discussing. The little details matter in language design, for code readability, cohesiveness, and so on.
- rowanG077 3y agoThen I got the wrong impression. I didn't expect someone to write a article about something they don't really care about.
- benhoyt 3y agoThere's a big area between "obsessed with" and "don't really care about"! I clearly care about it and think it's interesting and important, hence writing the article, but I have better things to be obsessed with. I don't think painting things in extreme terms like that is particularly helpful.
- simon_o 3y agoYour "it's just a matter of taste" just shows a lack of research. 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".