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 don’t like the begin on the same line after the then, and I prefer
indents.. it really does help a lot to make sure the correct things are
included.. 
 
if something then
   begin
      some code here;
      some more code;
   end
else
   begin
      some other code here;
      some more other code;
   end;
 
with complex code, the indents are a big help, but I also don’t like python
that is strictly defined by the indents.. it becomes too tedious.  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.  Its one of the reasons I
don’t care for python.. when I’m busy trying to get some basic logic figured
out, I don’t’ have time to count the indents.. it interferes with my thought
process.  I know I’m going to fix it later.. so I defiantly prefer my
program not to break if I get a little off on my indents trying to get
something done…  Yes PASCAL is my favorite language, and I only even look at
others if I need to.
 
James
 
 
From: fpc-pascal <fpc-pascal-boun...@lists.freepascal.org> On Behalf Of
Markus Greim via fpc-pascal
Sent: Thursday, September 24, 2020 4:12 AM
To: bo.bergl...@gmail.com; fpc-pascal@lists.freepascal.org
Cc: Markus Greim <i...@schleibinger.com>
Subject: Re: [fpc-pascal] basic question on begin, end;
 
Bo,
 
"Programs must not be regarded as code for computers, but as literature for
humans"
 
Niklaus Wirth, the inventor of PASCAL.
Last sentence on the last slide of his presentation. 
given at a conference to honor of his 80th birthday at the ETH Zürich in
2014.
 
(i had the honor to participate)
 
Kind Regards
 
Markus
 
<https://app.frontapp.com/api/1/noauth/companies/schleibinger_geraete_gmbh/s
een/msg_88fgbb6/han_9pzu6a/06a948e6.gif> 


On September 24, 2020, 10:04 AM GMT+2 fpc-pascal@lists.freepascal.org
<mailto:fpc-pascal@lists.freepascal.org>  wrote:
On Wed, 23 Sep 2020 08:28:20 -0700, Ralf Quint via fpc-pascal
<fpc-pascal@lists.freepascal.org <mailto:fpc-pascal@lists.freepascal.org> >
wrote:



>Similar like moving code blocks around in 
>Python with a one-off indentation and all the sudden the flow of that 
>code changes, without complaining...

This use of whitespace as block delimiter is why I never could cope
with Python when I was working (now retired).

Begin-end are really big helpers to correctly structure loops etc and
I use them all the time to make things clearer.

Also putting begin right below if, for, while etc makes it much easier
in Lazarus to see what happens in multi-level code when one is
selecting begin or end since they match vertically.
So I never do:

if something then begin
some multi-line code here
end;

Instead:

if something then
begin
some multi-line code here
end;

And of course as has already been pointed out the original question's
example code fundamentally changes execution with or without the
begin-end pair!

-- 
Bo Berglund
Developer in Sweden

_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
<mailto:fpc-pascal@lists.freepascal.org> 
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
 
<https://u8034135.ct.sendgrid.net/wf/open?upn=liJK2x9lrhmoNbCyBS0MpxjIPwWmvA
fUM4RgDSjskX7nFcRXYX2fLyQoEx3O9ue95UqCxFIA9QZrrCKGcQQC2kBTdrWioJPlJmwrNkQhl2
GGaOk8T5Rox8pMbkXXxQTYwMOFOwG6Nwc-2FqGstqwEqVu-2FkjQ7crJJID7Kg9M6VrsHMdp8q-2
BbQ6rSm-2BBAQNBoHNhaozWSkt-2> 
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to