Why Pascal?

Sometimes people ask "Why Pascal?"

After all, it's not the new hot trend, and hasn't been for a while. In the early 90s, everyone was talking about C++. By the mid 90s, everyone was buzzing about Java. Lately, the hum still mainly about Java for enterprise (and Android) developers, but is more about .NET and ObjectiveC from Windows and Mac developers - so why Pascal?

Balance:Many people fail to realize that the above-mentioned languages are not as revolutionary as they seem. Many of the features they tout as new have been available in the world of computer science for a very long time. They are only "new" in the sense that they are new to those languages. Ideally, we would like to have good implementations of cutting edge research languages. On the other hand, we have large code bases, and wasting a lot of time building standard libraries and bindings can be frustrating. These things don't necessarily apply to research languages, but they do apply to real-world languages. For example, If you want to use Scheme, Oberon, or Modula 2 to interface to Lotus Notes, you might be in for a lot of work. Pascal has the advantage of being large enough to have ports and interfaces for most things. For example, Unicode, XML, Web Services, and interfacing with DLLs can all be easily handled under Pascal.

Cross-Platform Compatibility:Many developers (especially commercially oriented ones) seem to forget about this in the rush - but in the long term, cross-platform capabilities are very important. While C is technically cross-platform at the language level, Pascal is also cross-platform at the library level. A programmer can use statements like Reset and Rewrite on all platforms. With modern GUI development systems, a single GUI can be written for a program and used under Max OS, Linux, Windows, etc. This isn't possible with C unless programmers use a separate external library such as QT. (Which, of course, brings it's own issues). Both iOS and Android programs have been written in Pascal, and pascal compilers exist for about every common platform, including OS/2, BSD, etc. Programming in Pascal is an easy way to have your software supported on a very wide variety of platforms. C and C++are cross-platform, but mainly only for trivial code - Pascal has a reasonably large standard library that can work without little to no code modification on a large number of processors and operating systems.

Speed vs. ReadabilityPascal programs typically compile directly to machine code, and can rival C programs in speed. at the same time, Pascal programs tend to be much more readable than C programs, and some error-prone functions can be handled by the compiler and/or run-time library without sacrificing run-time speed. (There are also compilers available which convert Object Pascal into JavaScript or .NET bytecode, as well as Pascal interpreters, which allow the language to be used for scripting - however these is not the primary focus of this article).

No Install RequiredPascal programs can typically be compiled into a single binary file (EXE file on Windows). This makes distribution and deployment easy and simple. Unlike Java or .NET, no large external run-time environment is required. In fact, no external files are required at all. We have all seen small innocent looking programs that do something simple that require you to download and install .NET or some other run-time, and then they require an installer, and finally take up large amounts of system resources - no so with Pascal. As another example: Classic Visual Basic programs required a runtime DLL, and typically properly registered OCX files for every component they used. This could get to be nightmare with larger projects and multiple versions of the files. The user could simply download the program and run it, even without administrator permissions to install it. By having the option to package everything into a single binary, the developer can reduce dependencies on DLLS, ActiveX controls, and other shared libraries and files - and thus things can be simple, and reliable.

Power ToolClassic Visual Basic is seen by many as a simple and easy to use tool for creating GUI applications, but it is really essentially a scripting tool for components that were created in C. Thus, in order to do any sophisticated development, the developer will have to learn and use C as well as VB. With Pascal, the components can be created and compiled in Pascal as well, resulting in ease of development and native compatibility. Since Pascal is typically compiled to native machine language, it can also be used to create shared libraries (DLLs, .so files, etc.) which can be used by other languages. (VB.Net is different, but also much more complex to use).

CompatibilityBecause Pascal is similar to C at low levels, C code can be linked into and called from Pascal programs with minimal effort. In fact, automated header conversion programs exist to do most things for the programmer. In order to use a C function, it simply need to be declared as such. Pascal routines can also be declared to use C calling semantics in order to allow C or other languages to easily access them. Recently, native compatibility with Objective C has also been introduced in some compilers.

Objects or ProceduresThe original Pascal was based on procedures and functions, though Pascal has long since graduated into the object oriented world. Despite extensive object oriented programming support, procedural programming is still available and fully supported. This means that the programmer can feel free to use the best tool for the job, instead of being forced into one paradigm or the other. For example, graphical objects can be coded as objects, while utility functions can be written in procedural style.

Sane OrganizationWhile languages such as C use crude includes and header files, Pascal use self contained units. This means that the compiler can independently compile individual units, with a dependency tree that is clear to the user. In addition, each unit contains public and private sections, meaning that code hiding from other units can be done even without objects.