Sunday, December 11, 2011

FreePascal experience

Tried FPC 2.4.4 recently, what I must say, Lazarus and console fpide are unusable under Ubuntu 11.10 and MacOSX -- crash all the time, no debugger support and strange GUI bugs, although I have not tried them under Windows.

However, the big POSITIVE side is that the compiler (FPC) is a lightning fast one and easy to install at any platform. It's even faster than javac. I'm really impressed. And GDB understands well pascal programs, tried to debug and it's amazingly feature rich. The language is plain simple and you can easily program in any decent text editor. I really enjoyed playing around with it. The generated applications are lightweight like in good old times, native, fast, not so hungry for memory and cpu resources. Also FPCMAKE is a good tool if you plan to develop a more or less complex application.

FPDOC tool is not what I like to use (it requires documentation not in the source comments but in a separate xml file), better to pick pasdoc ( for those who used to javadoc and doxygen.

As for the Pascal programs I've used -- they are not pretty stable, I think it's the fault of the poor memory management strategy applied. It's better to use reference-counting techniques like in GNUstep/Cocoa than TComponent's sole ownership and dangling pointers.

Playing with the compiler I have tried to implement a base class to do that counting and one more to track weak references. It was a success, so it's not the language fault but the programmers who use it, because my solution looks good and I plan to publish a library on GitHub if I ever program in FP.

One more deficiency is the lack of Unicode strings support in OS calls, e.g. for file names on Windows. Although it's no problem under Linux and/or MacOSX.

Generally FPC is a great tool, and there are a lot of useful libraries to make life easy.

1 comment:

leledumbo said...

It's unity's fault, believe me. Even eclipse and qtcreator suffer from the same problem. My lazarus (with qt interface, gtk2 is hell slow) and fpide runs rock solid under my Kubuntu 11.10