Write in C, write in C Write in C, write in C Pascal won't quite cut it Write in C
Ask HN: Anyone else use FreePascal as their low level language?
31–40 of 58 posts
Re: Ask HN: Anyone else use FreePascal as their low level language?
#32If you consider Go as a low level language, you might want to try C# which can be as low level as Go while having a lot of high level features. NativeAOT compiler allows you to statically link native libraries or create native shared libraries (.dll/.dylib/.so) that can be consumed from other languages. It's kind of 2-in-1 language, but the ecosystem is primarily focused on the high level part, so you can only depend…
Unsafe C# is the most unsafe language I've ever worked with. Really terrifying stuff.
Re: Ask HN: Anyone else use FreePascal as their low level language?
#33Tooling it a bit lacking, but the language is simple enough you can get away with using a semi-broken LSP.
The language feels light and expressive, and has generally gotten out of my way - the only thing I've been really craving is closures.
You might not like it because it has errors as return values like Rust/Go, however there are some directives/macros/keywords such as `or_return` which work a lot like `?` in Rust.
Re: Ask HN: Anyone else use FreePascal as their low level language?
#34Interesting fact: lately I've been benchmarking few things around and I have found out that the same algorithms in JavaScript tend to outperform C in O0. Why does that relate to your post? Because if you're going lower level for performance you may actually find your assumptions to not hold true unless a good compiler optimization phase is involved.
Re: Ask HN: Anyone else use FreePascal as their low level language?
#35Re: Ask HN: Anyone else use FreePascal as their low level language?
#36Pascal is not a low level language - quite the opposite. That being said, various implementations provide low level facilities, including turbo pascal back in the days , and free pascal which I did use in the early 2000s. If I were you, if you like fpc, I’d actually look into Ada ( the OO part is a bit odd granted but works ). You’ll get extremely high control over low level stuff ( it’s used in the embedded world )…
> Pascal is not a low level language - quite the opposite. Why do you say that? Back in the 80s and early 90s it was the primary competitor to C, and in an alternate universe we might have ended up using Pascal decedents instead of C decedents. For example the original Mac Toolbox was first written in Pascal: https://apple.fandom.com/wiki/Macintosh_Toolbox The original Mac API were all native Pascal: https://wiki.fre…
Re: Ask HN: Anyone else use FreePascal as their low level language?
#37The paper "C is not a low level language as we are not programming a PDP11" (something like that anyway) made a good point that C is only fast on a multi core machine because c fans work hard at keeping the laurel. What does a low level language look like when you have 8 cores? Conversely what would a high level language look like for (low level) verilog and FPGAs?
The referred paper C isn't a low level language - your computer isn't a fast PDP11 [1] was not really addressing multicore parallelism. It was discussing instruction-level parallelism , which is done within an execution thread and is achieved by speculative and out-of-order execution of instructions that do not have sequential dependency on previous instructions. [1] https://queue.acm.org/detail.cfm?id=3212479
> The cache coherency protocol is one of the hardest parts of a modern CPU to make both fast and correct. Most of the complexity involved comes from supporting a language in which data is expected to be both shared and mutable as a matter of course.
I feel like we live in a world where everyone works very hard to pretend that C is our best low-level language, when in reality an APL-like purely functional array language would be a better candidate.
Re: Ask HN: Anyone else use FreePascal as their low level language?
#38If you like go, modern pascal is basically that with less curly braces. The other way around is true, too. There’s zero technical reasons to not use pascal. Popularity, library availability, programmer availability and LLM quality of responses may be, but the technical foundation is there and has been for at least a decade (if not since turbo pascal from early nineties.)
Re: Ask HN: Anyone else use FreePascal as their low level language?
#39I think Object Pascal is quite a nice language, it feels like OO without a whole bunch of messy package protected Java nonsense.
Re: Ask HN: Anyone else use FreePascal as their low level language?
#40FP is an interesting language. In my opinion, it is somewhat problematic that different language concepts (Delphi, etc.) have been more or less merged into FP, resulting in redundant object models, for example. Pascal as a language also has various historical legacy issues (dangling else, block overhead, global namespace, etc.), which Wirth corrected in Modula and Oberon. The compiler is huge and apparently difficult…
> In my opinion, it is somewhat problematic that different language concepts (Delphi, etc.) have been more or less merged into FP, resulting in redundant object models, for example. That was not an FP invention, though. Delphi already did it - they kept the Apple's Object Pascal constructs from Turbo Pascal, and then bolted a whole new object system in parallel. FP inherited that mess and has to maintain it for backw…
The compiler is insanely large and complex, more than the sum of the implemented languages would suggest. I can't imagine that anyone still has a complete understanding of it. See e.g. https://github.com/rochus-keller/FreePascal/blob/master/Read....