[fpc-devel] Pascal Standard, and what we can do.

Frederic Da Vitoria davitofrg at gmail.com
Wed Jul 22 23:21:29 CEST 2015


2015-07-22 20:20 GMT+02:00 Paul van Helden <paul at planetgis.co.za>:

> I have never managed to understand why "declare before use" is so
> important to Pascal. I get the bit about strong typing and doing everything
> possible to eliminate errors at compile time, but I still don't get why. If
> this is central to what makes something "Pascal", I would love to be
> pointed to a good explanation. I'm not trying to be a pain here. I've been
> programming in Pascal, full time, for most of my life. It has always
> puzzled me why everything has to be declared first.
>

Declare before use has at least one technical advantage: it allows to make
much faster compliers. Declare before use allows to compile in one pass,
while compilers for languages like C need at least 2 passes.

But declare before use is also part of the Pascal philosophy. Pascal tries
to prevent you from programming by just throwing in some straws, some nails
and a bit of wire when needed. Pascal was designed so that you have to plan
first and code only when your plans are ready. If you want to do quick and
dirty programming (I agree doing complete plans before would sometimes be
overkill), then use a scripting language. Of course, other 3rd gen
languages also allow you to do completely structured programming, but
Pascal was created to push users to do it. There is a joke about Pascal
that Pascal is so coercive about "good programming" that you could program
in Pascal for years and still not learn how to program correctly. Hmm,
maybe this is not entirely a joke :-)

-- 
Frederic Da Vitoria
(davitof)

Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20150722/b8694d74/attachment.html>


More information about the fpc-devel mailing list