Recent

Author Topic: Comparing Pascal and Rust  (Read 13645 times)

AlexK

  • Full Member
  • ***
  • Posts: 101
Re: Comparing Pascal and Rust
« Reply #30 on: September 20, 2025, 08:09:12 pm »
There's a mode or can be added to FPC that will help to prevent bugs? I alredy see some in Lazarus code editor, like unused variables, not initialized variables, missing return in a function. A lot of warinings about conversions.

Well that's it, I'm not saying one languages is better than the other. But just saying that FPC has already features that make it similar to Rust.

It's supposed to be a task for static analysis done by a separate compiler-like tool which is launched when needed and can be configured for specific tasks, allowing the compiler to remain quick for iterative-exploratory programming and to be backward/forward compatible. https://en.wikipedia.org/wiki/Static_program_analysis

Some of distinctive features of Rust: immutable by default and there's no null. Maybe contentious for some.

Thaddy

  • Hero Member
  • *****
  • Posts: 18529
  • Here stood a man who saw the Elbe and jumped it.
Re: Comparing Pascal and Rust
« Reply #31 on: September 20, 2025, 08:21:31 pm »
It's supposed to be a task for static analysis done by a separate compiler-like tool
FPC has already wpo and that could be extended. (too few people actually use wpo)
Quote
Some of distinctive features of Rust: immutable by default and there's no null. Maybe contentious for some.
The original set of pascal instructions has no nil as well. If freepascal could add a mode to forbid pointer manipulations - not just {$pointermath off} but also @ and addr and the likes - it is also immutable by proxy.
Due to censorship, I changed this to "Nelly the Elephant". Keeps the message clear.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12572
  • FPC developer.
Re: Comparing Pascal and Rust
« Reply #32 on: September 20, 2025, 10:44:54 pm »
From the top of my head:

  • Traditional pascal runtime checks like overflow and rangechecking
  • Memory leak detection, -gh
  • initialize local variables to random values (to detect uninitialized variables) -gtt
  • Validate casting of classes (-CR)
  • Valgrind support -gv for some other checks, most notably memory corruption
  • Support for custom memory managers, that can have their own checking options (like cmem).


 

TinyPortal © 2005-2018