Re:GNU Pascal Compiler
by bluetomcat on Thursday April 27, 2023 @06:16AM
(#35725861)
Pascal was the more restrictive and more verbose language, whereas C had more expressivity and terseness. Most of what could be written in C, could be written in Pascal, minus the hacky stuff.
[ Parent
| on HN ]
Re:GNU Pascal Compiler
by DeathArrow on Thursday April 27, 2023 @06:36AM
(#35726020)
I was blown away when a colleague of mine wrote a little Pascal program which rebooted the computer in the lab. He wrote something at some memory address or port and the computer was running DOS.
Do you mean something like this? https://github.com/susam/reboot
Re:GNU Pascal Compiler
by DeathArrow on Thursday April 27, 2023 @07:03AM
(#35726230)
Probably.
Restrictive how? You had full pointer control in pascal and could drop to assembly with the `asm' statement.
Re:GNU Pascal Compiler
by bluetomcat on Thursday April 27, 2023 @06:40AM
(#35726048)
Pascal pointers are different animals. Since it is a strongly-typed language, juggling between ints and pointers or between pointers of different types is not allowed. Pointer arithmetic on a byte basis is also not straightforward.
That's... not true? You have `Pointer' for generic pointers and you can use `^' to indicate any type should be pointer based. You can then use Inc() or plain addressing plus arithmetic. And you can use `^' again on the right-hand side to dereference it.
And you can certainly juggle between different types. You can cast things in Pascal.
Pascal was a lot like BASIC in that every version added their own (often incompatible) stuff because the official standard language was so limited. Certainly you couldn't drop down to assembly in standard Pascal -- that sounds like something Turbo Pascal added and may be present in modern versions because of the popularity of that.
It’s less to do with limitations of the language and more to do with variations in compilers (each vendor wanting to add their own flair to sell their compiler) and a lack of standards.
You saw the same with C and C++ before they were standardised.
That’s a good thing.
I do like C but there’s no denying that it makes it ridiculously easy to fuck up. Whereas Pascal enforces correctness. Some view that as annoying verbosity but you can’t please all the people all the time.
dropping assembly was the killer feature for me. It allowed to migrate gradually from a very easy to understand language to more performance code, without having to understand what a linker does.
Only the ISO Pascal first edition, that barely anyone used outside of a teaching context, it initial purpose anyway.
Also why Modula-2 exists since 1978.
The next major release of GCC will have a Modula-2 frontend. I look forward to trying that out.
edit - Apparently it was released yesterday?
Yeah, now it only needs a VSCode plugin that does auto-formating (no need to explicitly type keywords in uppercase), and maybe some package management of sorts.
I have very fond memories of Modula-2. I hacked a lot of cool stuff with it (also with inline assembler) as a teenager. When I eventually switched to C and C++ because I was curious about learning, the overall experience was much worse due to the build system and much slower compile times. We were talking orders of magnitude here.