Free Pascal - First Impression [Programming Languages Episode 6]
ฝัง
- เผยแพร่เมื่อ 22 ธ.ค. 2023
- ►Full First Look Series Playlist: • Programming Languages ...
►Find full courses on: courses.mshah.io/
►Join as Member to Support the channel: / @mikeshah
►Lesson Description: In this lesson we revisit Free Pascal, a language that I have always liked, and remember using almost a decade ago. Free Pascal has a very exciting and long history in computer science -- ranging back 53 years to Niklaus Writh (a Turing award winner!). The language has evolved and their have been variants with Delphi being one of the most famous rapid application development (RAD) environments. We'll take a look at the Free Pascal Compiler (fpc) and briefly preview the language.
►TH-cam Channel: / mikeshah
►Please like and subscribe to help the channel!
►Join our free community: courses.mshah.io/communities/... - วิทยาศาสตร์และเทคโนโลยี
Hopefully Wirth's legacy would be honored for new years coming by the help of Freepascal Lazarus.
Agreed!
Finally Free Pascal came as my first language to learn programming. Haven't used it for a while, but that is a good nostalgic memory ❤
Seems most languages today have adopted the module style system -- ahead of its time! 🙂
A couple of things.
Pascal uses semi colons in most end of lines to tell the compiler to process the command. This is because back in the day dealing with multi lines was a pain (punch cards etc).
A full stop is used at the last end keyword to tell the program that it's the end (I don't know why but it's been this way since early/first versions of pascal).
So
program test;
begin
var a,b:integer;
Str:string;
begin
A:=1; B:=5;
str:='A string is an array of chars';
{ Old style strings are arrays of chars. They are 0 to 255 in length. index 0 is a counter of howlong the string is. Modern versions of strings like ANSI strings are a little different.}
Str[0]:=5;
{ This would make str contain 'A str'. Note that the other bytes will still be in memory and this is a really fast way to truncate/delete a string.}
writeln('A= ',a,' B= ',b);
end.
I think that code should work.
It was really nice to see Free Pascal featuring in your channel Mike. I learned a lot translating to Free Pascal what I learned with your SDL2 C++ series. Thank you man, you are awesome!
Cheers! Thank you for the kind words -- free pascal is one of my favorite projects 🙂
Fpc is very fast compiler. Faster than gcc, clang, rustc, dmd, ldc. Maybe go compiler is so fast as fpc.
Agreed! The way Writh wanted it as I understand
Best language ever. And its modern.
I really like Pascal -- interesting to see how it continues to influence modern languages and continue to evolve as you say!
Freepascal has a great range of supported platforms. Even before llvm was a thing.
Remains a real strength -- it's a good argument to make for starting and maintaining a project using fpc and the Lazarus IDE
With Delphi, the Pascal language gained some expression outside the educational environment, but also with this, the majority of users specialized in the niche of commercial applications. Many of those who still program in Pascal, using Delphi or Lazarus, still work in this type of application. I realize, however, that the language would be quite efficient in many of the areas in which C and C++ dominate today, such as operating system programming, games, etc... What led to the choice of one and not the other? Destiny!!! The fact is that there is a lot of work done in Pascal (Object Pascal) that needs to be rediscovered; Perfectly viable solutions were passed over simply because it was not the fashionable language.
It's interesting to see how many Pascal features (modules, fast-compilation, ranges, string library) is the standard for any new language these days :)
@@MikeShah I was looking at a vdeo of go lang for a few moments and I thought it was pascal.
@@skilletpan5674 certainly inspired by pascal 🙂
What a wonderful high-school throwback! Thank you! I was back then a c snob but remember the also pascal demo scene which took me by surprise, how easy it was to embed epic asm code, as well as the amazing free compiler/ide in the 2000s... And of course Éric Chahi French legendary another world/out of this world programer which still blows my mind today as back then as to how he vectorized videos onto a floppy
Cheers! Indeed, quite a lot of cool stuff coming out of the demo scene era. Eric Chahi really did some amazing work -- Fabien Sanglard (interviewed here: th-cam.com/video/wkGC9B0iGsE/w-d-xo.html) mentioned that Another World would have to be one of his favorite projects and is bookworthy if we are to get another Black Book of Game Engine Programming 😀
@@MikeShah besides the great world I was so many years wondering what kind of magic programming he must've done to get minute long videos... On a floppy!! They would have in even .avi format a decade later had filled all my hdd. And I guess he had to program not just the game but these movie tools!
Indeed! Just super amazing work. The demoscene folks have/develop amazing tools to uncompress data and lay out full cinematics @@VoidloniXaarii
Purely coincidentally there is a new Lazarus release today as well! forum.lazarus.freepascal.org/index.php?topic=65612.0
Pascal was the future once!
There is a full featured console development environment with the name 'fp'. And lazarus is a RAD (rapid application development) environment for developing desktop GUI applications. All in all, Free Pascal, with its language features and the support for numerous operating systems, processor architectures and development environments, probably offers a more comprehensive environment for full stack development than many of the currently much more popular programming languages.
The free pascal ecosystem and environment is wonderful -- I always will wonder why more do not use it.
1 program merryXmas(output);
2 begin
3 writeLn('Merry Xmas!')
4 end.
writeln("happy holidays to all!");
Borland's version of Pascal was my favorite language to use back in the 90s. IMO, there was no better environment for writing DOS applications, than Turbo Pascal. Not sure why FPC doesn't seem to get the respect that it deserves. Maybe it really is just a relic from a by-gone era and I'm looking back at it with rose-colored glasses.
Also, I've written stuff in Oberon-2 before ... not professionally but for fun. Oberon-2 is basically Modula-2 with some stuff I guess Wirth thought was extraneous taken out and with object-oriented features added in.
I always wanted to write more Pascal in the 00s, but every curriculum pointed me to C when I was learning. Couple of AAA games (I think Age of Wonders) gave me hope the game industry might adopt it more. Still remember the pascalgamedevelopment pages 😁
Most "serious" programmers don't like the way it's doing pointers and some other grammatical and abstraction. It's a perfectly good language for 99.9% of applications it's used for. It's still a bit clunky when it comes to bit level stuff though (It might be fixed now? last time I looked it was still a little clunky). Have a look at "Pascal (Not Just Nickel & Dime) - Computerphile" from computerphile. Professor Brailsford talks about why pascal wasn't as adopted at the time compared to other languages.
TLDR; it had some issues due to the design philosophy of the language to do with pointers and bit level manipulation of data on the computer.
Will be there 1st impression about Julia? Thank you, Shah!
TBD!
Love this series❤
Cheers -- glad you are enjoying it -- it's been incredibly insightful to make as well 😀
Maybe doing some prep before doing these "first impression" videos would be advisable. Earlier I watched the Ocaml one, where you were struggling with your initial try at using the REPL, and right on screen one could read the first line "Type #utop_help for help" but you evidently didn't see it.
In here, when you were trying to remember how to return a value from a function, you were looking at the doc for a function named Average, but you didn't notice that the last line was assigning the result of the calculation to what appeared to be a variable named Average, which is the standard Pascal way to return a function's value (and it doesn't have to be the last statement). The use of 'Result' in the Castle Engine examples is AFAIK non-standard and perhaps controlled by those "pragmas" (or whatever they're called) that you had to include at the top.
Good to know 👍 Yeah I go back and forth about prepping these, but I want to give as honest a first impression as possible. Whichever language I otherwise have a series for, I do much more extensive prep per video 🙂 It was interesting that the OCaml folks actually watched my video and made some updates based on the 'beginner' experience and seeing where I made errors😃
Niklaus Wirth died this Monday 😢
I saw the news 🙁-- a true legend in our field was lost. He had such a prolific career, and is one of the greatest influences in computer science in my opinion. His books remain high quality.
My comment keeps getting deleted 😕
Try posting in this thread maybe? I usually see the comments in an email but sometimes perfectly fine comments get filtered -- happens somewhat frequently
It is a shame that FreePascal hasn't become a more modern language. Nowadays a lot of things in Pascal looks so archaic. Even Ada feels much more modern.
Do u mind explaining what kind of modern features? Is it automatic memory management?
@@ClaytonAAlves for example, modern parsing strategies doesn't require a language to have begin-end and semicolons everywhere, or to have a separate var block where you need to declare all variables within function or procedure.
@@leffivanov3127 true, PascalABC is probably one of the most progressive and modern implementations of Object Pascal with functional programming constructs. Dr Kevin Bond, the author of one of the largest tomes on Delphi uses PascalABC to go over functional programming. 🤓
@@leffivanov3127 That's a stupid argument.
I think the language and libraries are still evolving as I understand 🙂