5 ms·
I always think it ironic that the C order of variable declaration prevailed for so many years (C++, C#, Java) yet in recent times several newer languages have d
by davidhbolton 5y ago
I always think it ironic that the C order of variable declaration prevailed for so many years (C++, C#, Java) yet in recent times several newer languages have discovered that the Pascal declaration order is handy for compiler type inference.
var age : integer; pascal
var age int - Go
var age : int - Swift
var age = 52; - Dart
var age: Int = 10 Kotlin
- pjmlp 5y agoIndeed, it is some kind of sweet revenge that most modern languages have reverted back to Pascal style of programming.
- Koshkin 5y agoWhile I appreciate the increased readability, I kind of like C being economical, in that it does not need all those pesky 'var', 'fn', etc. (On the other hand, I think C creators may have gone a bit too far with this when they decided that overloading the keyword 'static' was a good idea.)
- pjmlp 5y agoIt is so complex that people came up with tooling to actually understand when some devs go wild, https://cdecl.org/ https://cdecl.org/ Also the main reason behind the religous war in C++ of west const versus east const. Microsoft now got a couple of top devs on their C++ team that are on east const, so while we have about 25 years of Microsoft documentation, code samples and libraries using west const, the C++/WinRT team is now pushing for east const everywhere.
- cyber_kinetist 5y agoOh, and don’t forget the eternal holy war for the right asterisk/ampersand location! (SomeType* ptr vs. SomeType *ptr) https://stackoverflow.com/questions/2660633/declaring-pointers-asterisk-on-the-left-or-right-of-the-space-between-the-type https://stackoverflow.com/questions/2660633/declaring-pointe...