News for hackers. Stuff that matters.
Re:Free Pascal by andi999 on Sunday December 13, 2020 @09:39AM (#25406835)
If you know C you 'know' Pascal. What the best thing about Pascal (and its successor Delphi) was the blazing fast compilation time and I am not sure that freePascal has that.

Also what I really hate about Pascal is it is dishonest. It tells you it is very structured and your code will be better because of limited expressiveness. But then the 'writeln' 'function' needs to be intruduced at the compiler level - you cannot write such a function in the Pascal grammar. (maybe with freepascal you can nowadays)

What I liked though is that it didnt have the empty statement ';' so you really had to understand the semantics. Sometimes you were not allowed to end you statements with ';' (since they were ended by the block, so this would require the emptystatement). I think freepascal does not have this feature anymore (which is the thinking changing).

And just one more thing: Personally I would try to learn ADA before diving into Pascal.

Re:Free Pascal by jonsen on Sunday December 13, 2020 @10:19AM (#25407112)
> ... it didnt have the empty statement ';' ... > Sometimes you were not allowed to end you statements with ';' (since they were ended by the block, so this would require the emptystatement).

Pascal has empty statements. They are exactly that - empty. In C syntax ; is a statement end token, so the empty statement is ‘;’. In Pascal ; is a statement separator token, so the empty statement is ‘’, and ‘;’ is two empty statements. So the typical error is to write “....... ;” where only one statement is syntactically allowed.

Example:

  if x > y
  then x := y ;
  else ...  Syntax error. 
      Only one statement allowed between then and else.

  then { x := y ; }
  else ...    is Ok. 
      The blocking makes two statements into one.
Re:Free Pascal by andi999 on Sunday December 13, 2020 @10:26AM (#25407165)
thanks.
Re:Free Pascal by hsitz on Sunday December 13, 2020 @10:12AM (#25407062)
> What the best thing about Pascal (and its successor Delphi) was the blazing fast compilation time and I am not sure that freePascal has that.

I'm not sure how FreePascal compares to Delphi in compilation speed, but I expect both are blazing fast. The compilation speed is a result of the language design of Pascal, and the fact that compilation can use a "single pass compiler". Go is another language that has this feature. Compilation times are so fast that development can feel similar to using an interpreted language.

Re:Free Pascal by yawaramin on Monday December 14, 2020 @03:32AM (#25414745)
OCaml has this compilation speed heritage too through its roots in Modula-2: https://dev.to/yawaramin/ocaml-interface-files-hero-or-menac...
Re:Free Pascal by memsom on Sunday December 13, 2020 @09:45AM (#25406872)
No, sets. Sets are amazing. I still miss them to this day. Pascal also had sub ranges long before C# and the type system was very good. Delphi dereferenced its object model be default, so you could use dots rather than the awkward ^. Of pascal (-> in c++ and C)
Re:Free Pascal by JoeAltmaier on Sunday December 13, 2020 @09:46AM (#25406880)
Implementations sucked. They were bit vectors, limited to one machine word in length. So they were 16, 32 or 64 limited depending on where your program ran.
Re:Free Pascal by ac42 on Sunday December 13, 2020 @10:15AM (#25407080)
I'm pretty sure sets supported up to 256 elements (32 bytes) in Turbo Pascal on 16 bit systems, because you could manage ASCII characters with them. Yes, didn't scale. Yes, tons of use cases nonetheless.
Re:Free Pascal by benibela on Sunday December 13, 2020 @01:07PM (#25408594)
That is always so in Pascal

It has the best possible ideas, and then fuck up the implementation.

Recently, I tried to use a set on a three valued enum. With three values it should have worked perfectly. But no, the set was not allowed. Because the values were -1, 0, 1 and FPC apparently only can create set on non-negative integers

Re:Free Pascal by 7thaccount on Sunday December 13, 2020 @09:12PM (#25412750)
Ada and Pascal have some syntactic similarities, but I'm not sure they cover the same kind of niche enough for someone to say "I'd learn Ada prior to Pascal".

Today, Delphi is used in some shops the same way C# or Java is used in others. Free Pascal with Lazarus is kind of like a free version of that. You can quickly build desktop apps.

Ada is nothing like that. It's almost exclusively used in the defense industry and others like aviation and infrastructure where the code is likely to be embedded and can NOT fail.

One is for standard business and one for critical infrastructure.

Re:Free Pascal by andi999 on Monday December 14, 2020 @05:59AM (#25415648)
I agree, but then you wouldnt start new programs with Delphi these days, would you? (To me Delphi is the Cobol of GUI, will be still around forever, but less and less new projects)
Re:Free Pascal by 7thaccount on Monday December 14, 2020 @10:30AM (#25418623)
I don't think many start new projects in Ada either unless you're working for Lockheed Martin or another contractor and even then, they've largely gone the C++ route.

What do people use today? Java, C#, C, C++, Python, R, JavaScript, Php.

What might become popular someday? Rust.

Re:Free Pascal by andi999 on Wednesday December 16, 2020 @03:01AM (#25440150)
Yes, which worries me. I talked to a guy working in safety related software design (safety like car breaks), and they are going to C++, since there are not enough Ada/Spark developers. Which is a pity, since Spark allows you to prove correctness (in a special sense)