4 ms·
Ada and Pascal are both languages which allow multiple consecutive parameters with the same type and also use `name: type` syntax. I agree, even when using Ada/
by lpribis 2y ago
Ada and Pascal are both languages which allow multiple consecutive parameters with the same type and also use `name: type` syntax. I agree, even when using Ada/Pascal with colons its difficult to mentally parse.
- MaxBarraclough 2y agoIt's subjective, but personally I've found multiple-declarations always harm readability. It's especially terrible in C and C++, where you need to be on your guard for whether all the variables are being declared with the same type or whether some are pointers. Even in languages without this quirk though, I find it still slows my comprehension. Unlike readability, conciseness of code isn't a virtue in and of itself. I see little upside to multiple-declarations, but clear downside. Language trivia: the D language does not follow C's rule, instead it guarantees all variables in a multiple-declaration statement all have identical type: int* x, y; // x and y are both pointers to ints https://dlang.org/spec/declaration.html#declaring-multiple-symbols https://dlang.org/spec/declaration.html#declaring-multiple-s...
- kbolino 2y agoI think only C/C++ have this annoying quirk. C# is the same as D here and multiple variables declared in Go also all have the same type: var x, y *int // both pointers to int