I used to be a hard Delphi/Pascal guy and still think it is much better than C for it's strong typing and overall "squareness". But I'd have a hard time going back to it nowadays. The 'var' section, magic "Result" variable and begin/end pairs are just from another age. Programming languages have advanced _a lot_ since Pascal was created. It's core principles remain valid (safety by default, readability, flexibility).…
" The 'var' section, magic "Result" variable and begin/end pairs are just from another age...Programming languages have advanced _a lot_ since Pascal was created. " I understand why some programmers dislike Pascal's syntax, but C and C++ are also old and still popular (including for new projects). Syntax and semantics are closely entwined but C and C++ syntax still influence "modern" languages.
A guided intro to the Free Pascal language
81–90 of 102 posts
Re: A guided intro to the Free Pascal language
#82Earlier quoted context omitted.
I learned programming at school in Pascal and didn't have troubles with memory safety. FreePascal/Delphi has good standard library to work with strings and dynamic arrays and objects, and as long as you follow very simple convention with TObject.Create() and TObject.Free; you won't have memory safety problems. I didn't really have a need to work with pointers and do pointer math in Pascal, because language itself pro…
> as long as you follow very simple convention with TObject.Create() and TObject.Free; you won't have memory safety problems Is this the same as how in C, as long as you follow very simple convention with malloc() and free() you won't have memory safety problems?
if you were to pass reference around, then compiler would warn about potentially dangerous Free.
I don't remember ever seeing Pascal code where you received raw pointer and then directly casted it to your object type for example. Pascal has very powerful and expressive type system
Re: A guided intro to the Free Pascal language
#83Earlier quoted context omitted.
Embarcadero insane pricing of Delphi is the reason I haven't continued beyond my old version Xe2. I guess they are making hay while the sun shines with the locked-in customers.
Do they have the yellow-on-blue syntax highlighting trademarked or something? I've looked for vim and vscode color schemes to match the original turbo c++ but to no avail. I remember borland builder had a setting to switch back to it.
Re: A guided intro to the Free Pascal language
#84Earlier quoted context omitted.
Embarcadero insane pricing of Delphi is the reason I haven't continued beyond my old version Xe2. I guess they are making hay while the sun shines with the locked-in customers.
Do they have the yellow-on-blue syntax highlighting trademarked or something? I've looked for vim and vscode color schemes to match the original turbo c++ but to no avail. I remember borland builder had a setting to switch back to it.
Re: A guided intro to the Free Pascal language
#85Pascal killed my interest in programming for a while as it was force fed in both high school and earlier collage years. Reflecting back, it was the pessimistic approach to teaching of just pushing math problems via programming.
Pascal is great as a teaching language because of its simple syntax. It is also a pre-OO language, so you don't need to spend time explaining what classes and objects are. For an introductory programming course it is a very good language.
Pascal is way too verbose and boilerplate-ly compared to that.
Re: A guided intro to the Free Pascal language
#86- It has the most sane strings you'll ever see, you don't have to allocate them, and they can hold gigabytes of text.
- You'll never confuse equality tests = with assignment :=
- It's case insensitive
- It doesn't do macros
- It is one of the fastest compilers available
- It is one of the best GUI builders available
Things it doesn't do right
- Begin/End seems verbose to some people
- Other "standard" pascal systems gave it a bad name
- Historically, Borland et al, priced people out of their products and killed off a loyal use base.
Re: A guided intro to the Free Pascal language
#87Is there a way to use the Lazarus libraries, but write code in C++, like with C++ Builder?
I write lazarus programs, and link to my lib**.so files which are all written in C. Works very well.
Re: A guided intro to the Free Pascal language
#88Don't download the bundled Free Pascal and Lazarus distributions from this site, they're very outdated. Just get the normal releases from the actual Free Pascal and Lazarus sites which are linked at the top of the page. Lazarus comes with Free Pascal bundled by default anyways, so you don't need to grab the compiler separately if using Lazarus.
Re: A guided intro to the Free Pascal language
#89Note for people who don't know much about FreePascal. It is a full-featured and very fast compiler. The resulting program is a rival for the best output of C/CPP compilers. It can be used in the style of simpler languages like Go and is almost as safe as Rust in a much faster manner. It has a great but old-looking IDE, Lazarus. It has been under active development for decades and is used for proper projects like: htt…
I don't believe you regarding "as safe as Rust." It's been a minute since I've messed with FreePascal, but as far as I know and can ascertain at a glance, it lacks any true modelling of memory safety to even match Go, and certainly not memory ownership to match Rust. It is surely possible to write correct programs in Pascal, and maybe even easier than C, but it would not be accurate to describe it as "as safe as Rust…
I stand by what I said about speed: I've been comparing the resulting code of GCC or Clang and FPC for years, and if you know what you're doing, the resulting speed will be almost the same. Sure, Clang does some quirky things, but at the end of the day, I've never seen a piece of code written by the same person in both languages (the result of one mind with one style of code) that resulted in a different speed. To be fair, GCC or Clang are a step ahead because they are the result of millions of dollars in corporate support, but my response was to emphasize that the speed is not what people remember from decades ago. As a sample, you can try the Dadroit tool, I linked, I am on the team, and you can compare a result of Pascal with similar tools.
And I agree with you. Don't get me wrong; despite my passionate response about Pascal, I am not saying that Pascal is a one-to-one replacement for new languages; my thesis is that you have most of the cool stuff you hear in this old language too, just without the hype, to encourage people to give it a try and not repeat the old "Pascal is old."
Re: A guided intro to the Free Pascal language
#90Don't download the bundled Free Pascal and Lazarus distributions from this site, they're very outdated. Just get the normal releases from the actual Free Pascal and Lazarus sites which are linked at the top of the page. Lazarus comes with Free Pascal bundled by default anyways, so you don't need to grab the compiler separately if using Lazarus.
I downloaded Lazarus from its release page on Github and after installing it didn’t work, saying it needed extra binaries that it couldn’t find. Now I have to see what it’s talking about, what to install, etc. Kind of a hassle.