Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Modern Object Pascal Introduction for Programmers (castle-engine.io)
22 points by andsoitis on June 17, 2023 | hide | past | favorite | 3 comments


This is a nice introduction. Apparently the author also implemented a full game engine in Object Pascal: https://github.com/castle-engine/castle-engine/. I wonder whether the performance is sufficient; according to available benchmarks (e.g. the CLBG) the code generated by FreePascal is about three to four times slower than C/C++; does anyone have experience with it?


FreePascal is a compiler, C and C++ are languages.

When using polyglot compiler toolchains there is hardly a big difference.

For example, nowadays Delphi uses LLVM as well. The code generated by it and C++ Builder are quite similar.


> FreePascal is a compiler, C and C++ are languages

Thanks for this really helpful remark. FreePascal is a compiler and also a Pascal dialect (actually two, one with classes). All examples in the referenced document start with "{$mode objfpc}", i.e. the OO FreePascal dialect. The CLBG results are also from the FreePascal compiler, currently version 3.2.2 (compared with GCC 12.2). The question was whether the generated code is fast enough for the game engine.

And yes, there is even an LLVM backend for FreePascal, but it's not the official one, only supports a fraction of the platforms, and the generated code apparently is not really much faster.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: