Recently, I was looking for a programming language to just play around with. Just something that I could do some trivial programming and yet come up with something useful in the end. By day I work in C#, C and C++ so I really wanted to get away from curly braces. I had been playing around with Smalltalk with Pharo but the emphasis there has move to web programming. Too many moving parts. I really wanted something that would compile and let me still work more on a machine level as opposed to working with a VM. Surprisingly, my search took me back to Pascal.
Ok, I haven't touched Pascal in close to 20 years why did I look at it now with so many newer languages available. Call it nostalgia but I do like the readability of Pascal. Plus, its somewhat old school approach of define everything before you use it. C# is very messy allowing you to define things anywhere. So I took the plunge and set up a Pascal development system on my Linux box.
At the beginning I just installed Free Pascal since I really like using Emacs as my main development editor. However, after playing with this I found myself having to do too much work switching back and forth between the editor and the web browser googling lost knowledge. I broke down and installed Lazarus. This IDE is a clone of Delphi and can really push you forward when developing in Pascal.
Pascal compiles fast. As a hobbyist I use an 8gig laptop with a 2 core i3 processor. I want my new code to compile fast so I can try new things with it. In fact this fast compilation will encourage you to refine your code as opposed to wondering if it is worth the compile time. In fact the Lazarus IDE will compile in about one minute. So you will loose nothing by trying new things.
I was reminded of this when I discovered that Raspberry PI is supported by Lazarus and Free Pascal. In a Youtube video changes were made and tested so fast I thought they were using a scripting language at first. It turned out they were using Lazarus and Free Pascal.
Free Pascal does not use directory structure as a part of its namespace. Only the file name is used. So you can keep all of your code in a single directory. Each file is a Unit which consits of an Interface and an Implementation. So in a single file you have your header and code if you compare it to the .h/.c files when using c. The unit name is by convention the same as the filename.
Sounds like an Oxymoron but Pascal pointers are safer then those in C. True, you can still have memory leaks but pointers in Pascal have real types. You cannot simply cast to a different type and overrun the buffer. Of course if you really want to Free Pascal offers a Pointer type just like C's void * in case you really want to shot yourself in the foot.
I love to play with Objects. Free Pascal uses a Single Inheritance model that is very similar to C# and Java. All Classes are derived from TObject. It also has Interfaces. Free Pascal does not have a separate operator to create objects. Instead the class can create objects. This is similar to Smalltalk which works the same way. All objects are created on the heap which means that the programmer has to ensure that they are freed to prevent memory leaks.
This one is my favorite, no DLL, Shared Library, Jar file... Hell.
As a hobbyist I like to be able to give my friends a single file that they put on their computer and run. Frankly, I think that is what open source is all about. Being able to share your work with other people.
I started this SourceForge repository as a way to share my work. This was by no means meant to be a Pascal good all other languages bad type of article. But I wanted to show that Pascal has something to offer particularly for the programmer who just wants to create his ideas.