Add indentation for CONST, Type and Var blocks like in the ancient language Pascal #4734
Replies: 1 comment
-
As C# and the C family of languages don't have any imposed limitations as to where you may declare your variables the introduction of declaration blocks makes little sense to me. In Pascal the variable declarations are outside of the method block, but there's no practical place to put said variable declarations in C#, and the scoping rules in C# would dictate that variables declared in either a child or sibling block of your code block would not be in scope. As for readability, I think it makes the code a lot less readable to have to declare the variables far away from where they will be initialized and used. Seeing those variable declarations outside of the context in which they are used forces the developer to dart their eyes back and forth. But if it's your preference to force declaration at the beginning of a method you can always write an analyzer which will error if a variable is declared anywhere else in your code. Something tells me that would not be a popular analyzer. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Add indentation for CONST, Type and Var blocks like in the ancient language Pascal at the beginning of program and functions. That boost the readability of the code while there is one place to declare the CONST, Type, Var stuff.
Beta Was this translation helpful? Give feedback.
All reactions