Hacker News new | ask | show | jobs
by clouddrover 2324 days ago
> I can’t write ‘writeln’ in Pascal

Let's not talk about Pascal from over 40 years ago, let's talk about today's Pascal. Why can't you write "writeln" in today's Pascal?

1 comments

According to Rosetta Code [1], “Standard Pascal does not allow variadic functions” — though specific implementations have proprietary extensions which allow this.

[1]: https://rosettacode.org/wiki/Variadic_function#Pascal

None uses that "standard" when writing stuff in Pascal. Real world uses either Delphi or Lazarus+FreePascal. Both of them have Writeln and variadic functions
Note, I think the point wasn't that Pascal didn't have writeln, rather that you couldn't write (implement) writeln in Pascal (presumably due to missing variadic functions).

So having writeln isn't really the issue, the issue is that writeln is magic/a built-in.

Is free pascal self hosted?

You could write something along the lines of `writeln` using `array of const` with today's Free Pascal. It's still strictly better that it's actually implemented as a built-in for various reasons, though.

Also, yes, Free Pascal is entirely self-hosted from the bottom up, making use of inline assembly blocks in some places where it's necessary. It is to Pascal what GCC is to C and C++, basically (which is to say, it has no real dependencies on toolchains other than itself).

> Is free pascal self hosted?

Yes.

Which compiler are you going to use for "standard pascal"? The Pascal compilers you're going to use in practice are either Free Pascal or Delphi. They are what Pascal is today:

https://rosettacode.org/wiki/Variadic_function#Free_Pascal