[fpc-pascal] basic question on begin, end;

Bernd Oppolzer bernd.oppolzer at t-online.de
Sat Sep 26 10:58:51 CEST 2020


Am 25.09.2020 um 22:16 schrieb James Richters via fpc-pascal:
>
> I think that’s a GREAT quote from Niklaus Wirth, and I agree with that 
> whole heartedly… programs should be readable by humans… otherwise do 
> all your programming in assembly language… the whole POINT of a hi 
> level language is to make it readable by humans… not computers.I can’t 
> stand trying to muddle through things like C++,it’s just to 
> confusing.. trying to follow all those curly braces and figure out 
> what this line of code is going to do.. it’s just a mess. yes I can 
> manage, but I defiantly prefer the clarity of PASCAL… so I also name 
> my variable very clearly instead of using cryptic shorthand.. who 
> cares how verbose my variable names are… it doesn’t make the program 
> any less efficient.. but very clear function and variable names sure 
> make it easier to remember what you were thinking when you have to go 
> back and modify code you originally wrote 30 years ago.
>
>
> ...
>
> I admit my code gets a little sloppy with the indents, so after a 
> while it sometimes looks like:
>
> if something then
> begin
> some code here;
>
> some more code;
> end;
>
> at least it compiles correctly because the begin and end; are defining 
> things… once I get a function or procedure working the way I want it, 
> I will then take the time to go back and fix my indents.
>

Same for me, except that I totally automated the process of fixing the 
indents;
when inserting new code into a program, I don't care much about 
indentation;
instead after compiling successfully, I run a (self-written) Pascal 
program which fixes the
indentation etc.; it also draws boxes around certain comments and 
inserts blank lines,
when necessary. The parts of the program, which are already well-formed, 
remain unchanged.

The program, which fixes the indentation, is in many cases scheduled 
automatically after
a successful compiler run.

This is how a program looks after automated indentation:
https://github.com/StanfordPascal/Pascal/blob/master/PASCAL1.pas

Kind regards

Bernd


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20200926/410ae0b9/attachment-0001.htm>


More information about the fpc-pascal mailing list