Hacker News new | past | comments | ask | show | jobs | submit login
Turbo Pascal: A Great Choice for Programming Under CP/M (2013) (techtinkering.com)
150 points by elvis70 on Jan 30, 2021 | hide | past | favorite | 115 comments

The first software "product" that I sold was created using Turbo Pascal running on DOS. I was in high school at the time. It was designed for an Orthodontist who wanted to input (using a tablet with a cross-hair "mouse") about 20 points from an X-ray of a patient's head, then perform some calculations on the geometry to predict how the jaw bones and teeth were going to develop as the patient gets older.

To this day I think it's the most interesting and satisfying thing I've ever done in terms of software. Despite getting a Ph.D. in computer science and working for Amazon, Microsoft, and Cray, nothing even comes close, with the exception of one project at Microsoft Research. These days I've given up completely any hope of working on something even remotely interesting or satisfying.

I used to feel this way, and I wanted to rekindle the fire I felt when I was younger and absolutely in love, mesmerized with writing software. After a few years of that, I went into the professional world, and can relate to how you and others in this thread feel, about the dullness and lack of satisfaction. I remembered those times, though, and I kept looking for something to do.

I realized what the difference was: Back then, I was programming for myself, for the enjoyment of it. I was dogfooding everything, at times I was not only the top user, but the only user of my software.

So I went back to doing that, and I can happily report that I feel that way again. It can be done, don't give up hope.

Yeah, back in the days I was in the demoscene, coding for fun. 25 years later, I started coding demos, on Apple 2 (yep, that old machine I had when I was kind). You can call it nostalgia, but hey, that's coding for fun, pushing the machine to the limit, taking time to optimize for speed or memory instead of customer's satisfaction. Plus you get to meet other passionnated people, like before.

So yeah, it's somewhat "going back", but at least, I can express creativity in some unbounded ways. Plus, I code my dream, not the dream of the company which is paying me :-)

Nice! I decided to go back to the old Web days and write something which really does work in ANY browser.

So far, I've reached back to Netscape 2.x and Mosaic :)

So all you need is Safari support. Should be easy right. Jeeve Stobbb$

I am going trough the same stage and started developing the game that I wanted to develop as a kid on my first home computer: a Commodore 16. At the time I learnt to program in 7501 ASM ( a 6502 derived CPU ) but the endeavour was too much for a kid given the tools of the time. Nowadays is way easier: I have a sort of IDE built over emacs, can easily design ( and rip ) sprites and charsets, can mix code in macro ASM and a C-like language and can easily debug on an emulator. It's really a joy!

I've had a similar experience. Every time I get a glimmer of an idea of something I'd have fun building, my thoughts immediately go to my devops workflow, hosting, cross platform, updates, testing, security, tax, patents, viability assessment... and my professional experience has suffocated my idea before I've even built a fun prototype just for myself.

Maybe the disillusionment does not have it‘s origins in your work situation but stems from other areas of your life? - I am in my late fourties, and I feel great satisfaction whenever I am sitting at my desk and writing code, hacking, automating stuff, solving problems using my computer. - I have a similar anecdote regarding Turbo Pascal. In highschool, I had visualized a breakdown of vector forces in an electromagnetic field, and my teacher was thrilled. In order to be able to do that I had written my own vector and matrix calculus libraries.)

Your comment comes as a kick in the gut to me. I feel the same but didn't realize it until I read your comment.

For me, programming has become largely unappealing since the advent of cloud computing (which happened shortly after I entered the market). I really miss the first years of my career.

I also miss my early years, writing programs on a BBC Micros or for Windows 3.0 in Turbo Pascal for Windows. Now everything seems sanitized and no longer challenging.

I think it's the learning experience and result we crave.

For many years, I'd get frustrated with jobs where the projects were invariably limited to copying and caching data. I kept moving from one job to the next, hoping to find something better. Life is better now that I'm no longer searching for that elusive unicorn.

Now that you are older and much more experienced, have you considered the following?

1) Find some worthy students and be their mentor

2) Do Program something you really want or enjoy, e.g. a game or a new language

Young musicians who are thinking of pursuing music as a career are often given the advice, that doing something that they really enjoy as a hobby can become a burden when it becomes a job.

A hobby lets you choose your own battles, work on your own schedule and terms, gauge your progress by simple measures such as personal satisfaction or helping someone with their own life. Career means all of the ** that comes with the job, and doing mostly stuff that other people want.

Granted with music it's a bit more extreme, since a middle ground of doing fun work for subsistence money doesn't really exist.

I hope you won't take my curiosity badly, what made this first project so much better ? it seems interesting but short in perimeter too. Was the rest of your career dulled by politics and large projects management to the point of making the work sluggish and boring ?

What made that first project rewarding is that I had to figure out the math for doing certain geometric calculations: find the angle between the line through these 2 points and the line through these other 2 points. Find the orthogonal distance between this point and this line. Etc. Also, writing code to poll the COM port to communicate with the input device. Those are interesting problems to solve. You get a sense of accomplishment from solving them.

Fortunately, in my professional work, I'm not affected by office politics, and I can handle the overhead of project management. It's just the lack of opportunity to write code that does something interesting (figure out an algorithm that does something non-trivial with this data) that bugs me.

So the lack of intellectual stimulation then ? you need a harder job :D

I have a good friend who has avoided big-co software work his whole career. He writes software for telescopes. Often, it's in Haskell.

He does not have this problem, but I suspect he's left lots of money on the table as a result.

It seems like the "modern" way to write Pascal would be with FreePascal ( https://www.freepascal.org/ ) and the Lazarus IDE ( https://www.lazarus-ide.org/ ) both of which seem like stable, open and capable projects.

That said, i'm afraid that modern Pascal isn't awfully popular, which hurts its practicality a bit (e.g. learning about it, finding tutorials and others' experience with it, getting help). However, it's approach to native GUI development is pretty good, the language itself seems pretty okay and the compilation times are generally pretty good, as is performance ( https://benchmarksgame-team.pages.debian.net/benchmarksgame/... ).

Perhaps the only actual dealbreaker i can think of, is the fact that it doesn't have that many stable or even first party web development frameworks/libraries ( the closest i've found to that being https://wiki.freepascal.org/fpWeb_Tutorial and https://wiki.freepascal.org/fcl-web ), however they don't seem to be as popular as the "de facto" frameworks of the other languages. For example, Java has Spring (and Spring Boot), Node has Express, Python has Django (or even Flask), Ruby has Rails, .NET Core has ASP.NET Core, which are all widely supported and well documented, with plenty of tutorials.

Of course, that has only been my limited experience, since i mostly work with the other alternatives at my workplace and only dabble in Pascal occasionally in my free time. Would anyone care to comment on their experience with modern Pascal as well?

The most powerful and stable web framework is mORMot, it supports both FPC and Delphi. Here is its version 2 in development: https://github.com/synopse/mORMot2

I use Delphi all the time, IMHO, it's the best tool for Windows desktop app development - concise language, blazing fast compile time, easy UI design, flexible UI framework, all-in-one IDE, and so on. It's such a joy to me :)

And here is my new desktop software written in Delphi: https://docxmanager.com/

I had my share of porting C# GUI programs to Object Pascal (Lazarus/Delphi). I think the best part of FreePascal are the "outputs". I will always choose native GUI easily multi-platform programs over framework-dependent bytecode Windows-biased programs. It's also pleasant that you don't have to spend hours figuring out how to compile popular GUI framework X for C/C++ while Lazarus/Delphi just works out of the box. For the latter, the de facto GUI framework feels more in "harmony" with the language/compiler toolchain.

However, as a language, Pascal is a bit of a pain. The parts that frustrate me the most, are the necessity of editing code across separate locations when introducing a new variable/function and the lack of smaller scopes beyond function scope. Brian W. Kernighan's "Why Pascal is Not My Favorite Programming Language" (1981) lists some of these frustrating parts, although there are many improvements since then.

I think more recent pascal compilers now support declarations elsewhere aside the interface section or beginning of a function. But more recent also means less support for older systems, which is part of what I like about Pascal.

And if my program doesn't need a GUI, I feel that C/C++ is far more productive for multi-platform-compilable native programs.

FPC/Lazarus gets my vote for a great FOSS project. Going strong for three decades now.

> It seems like the "modern" way to write Pascal would be with FreePascal

The latest language from Niklaus Wirth is Oberon which was last updated in 2016. It is both smaller and more capable than Pascal.


As long time follower from Niklaus Wirth work, Oberon is more capable than Pascal, only if you are speaking about the original edition of Pascal in the mid-70's.

Yes, what I have in mind are the languages designed by Niklaus Wirth. What's fascinating about Oberon is how small and clean it is compared to equally capable languages.

Just to stay within what Extended Pascal and Modula-2 allowed for.

The original Oberon and Oberon-07 lacked any support for subranges, enumerated indexes for arrays, co-routines, monitors and exceptions.

Oberon-07 goes even further cutting features from Oberon.

For me the best language from the Oberon family is Active Oberon.

Oberon-07 is a nice exercise in minimalism, but not something I would enjoy using in production.

As the famous quote by Antoine de Saint-Exupéry goes: “Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.”

True but it is also exponentially more obscure in usage.

Indeed, for a long time there was no freestanding compiler (Oberon is also an operating system) which you could use to create programs on any computer. The OBNC compiler, which transpiles to C, solves this problem:


In what ways is it more capable than Pascal? At first glance Pascal seemed to have more features (including discriminated unions)?

To name a few, Oberon has extensible types which enables object oriented programming (and makes discriminated unions superfluous). It supports modular programming. It also has so called open arrays which allows passing arrays of any length to a procedure.

Pascal is under-appreciated. TurboPascal was my first programming language/platform on PC (used 286 in 1994) and the only problem I had was lack of documentation on actual video and sound hardware, not with the language itself. I was surprised to learn that many DOS-era games I loved were written in pascal actually, some of them were pretty performant (Tyrian, for example).

Almost on the topic: in Russia there were popular school computers UKNC https://en.wikipedia.org/wiki/UKNC, pdp-11 clones with deep changes, with an RT-11 compatible OS. They were everywhere, well into late 199x, when they were deeply obsolete, because schools didn't have funding to upgrade classrooms. It was my first computing platform when I was a kid, but the only language accessible was BASIC, with a line editor (pretty strange concept nowadays), line numbers, no named subroutines, etc. In 1997 I was suprised to find in a new school I've transfered to the same old computer but with Pascal compiler on it. With an actual editor, a very fast compilation time, and all still crammed into 64kb of memory. I was really impressed.

Here in Bulgaria we had Pravetz computers and Pascal was learned in past on schools.

Pascal was one of my earliest exposures to programming.

MS just released Windows XP, I was in high school. Back in those days, people used Basic, Pascal, and C for programming competitions.

Already had some experiences with Basic, and found C to be too "low level" for my taste, I picked Pascal. Next year, I jumped into Delphi: learning Win32 GUI basics and some database programming with MySQL. Probably pretty advanced for a high school kids, since most of my friends were interested in music or games :)

I never used Pascal/Delphi for work though, because Java has been a major player in mobile development scene (J2ME -> BlackBerry -> Android....).

One of the things I appreciate about Pascal compilers is: blazing fast compile time. And I think it still applies to FPC (Free Pascal Compiler).

You can rebuild the whole compiler + basic libraries from scratch under 5 minutes. Can't say the same thing about GCC. Well the last time I did this was in 2014 (or 2015?), though.

Now, if I want a native compiler with fast compilation speed, I'd pick Go or Nim.....

The latest version of Delphi compiles 1 billion lines of code in 5 minutes on a 16 core 5950X and 2 minutes on a 64 core 3990X.

Thanks for increasing my interest in FreePascal / Lazarus (which I've been looking into for the past few days.)

We were taught C and Pascal in college, and I distinctly remember thinking out loud, "Wow. Why do people bother with C when Pascal seems so much easier to understand and just nicer?" (Ofcourse, in hindsight, I now know Pascal was easier to understand because I had already learnt programming concepts with C previously). But I still prefer Pascal's overall 'ideology' and syntax over C (except for the BEGIN ... END - would prefer braces :).

May be obvious to some, but the braces can be replaced by BEGIN and END keywords by multiple methods, including careful editor search and replace, or use of a preprocessor before compiling (may not handle tokens in strings or comments), or maybe the best option, by hotkey mappings, like BEGIN to some key combo, and END to another.

Oh yeah, I do know that with modern editors it's not such a chore anymore. I just mentioned that as an example of verbosity that slightly annoys me. (The same with Ada too, which I understand also draws inspiration from Pascal).

Yes, I get you now. Agree about the verbosity issue, although, interestingly, it did not bother me at all in Pascal, which I learned as my 2nd language or so, before C. Noticed it even in the syntax of BCPL (C's grandpa), and, IIRC, BLISS, and of course Eiffel. The 2nd- and 3rd-last above were before my time, only read about them in books. I like Eiffel for many reasons, though. A real pity it did not get more popular.

I found BCPL quite cool too, except for the verbosity, which, like Pascal, I did not much feel at the time. I read the whole (slim) book about it, by Martin Richards, its creator, and enjoyed it. Good amount of low-level system programming examples in the book, and it all being in a language with only one type (the machine word), made it more fun to me, although (or because) I did not know of higher level programming constructs at the time.

Its history and uses are interesting.


Java, .NET [0] and D do it for me.

But I do share a similar Pascal story, just a decade earlier. :)

[0] - People keep forgetting there are AOT toolchains (and JIT caches) for them.

Pascal remains my preferred programming environment. Though a bit buggy, and short on documentation, Lazarus/Free Pascal makes quick work of any forms based windows application.

I worked through the entire Advent of Code 2020 exclusively in Pascal.


In case others would like to skip the trip through mike's blog ;)

I'm surprised at how modern a lot of the code feels.

That goes to show what we already had back in the MS-DOS days in language capabilities.

At sometime around 1976 Pascal was The Language of the Future. There was some project to program an OS with Pascal in Helsinki, possibly the Russian MIR-computer. Anyways I heard a heated discussion where they wanted money for "tens of man-years". Very annoying, so I wrote Pascal-compiler for 8080 just like that in few months. It was little restricted but quite usable. Then Very Strange Thing happened: the Finnish Army wanted it, maybe because it was not hampered by American Comecon-embargo and better than nothing (or assembler). I was ordered to write a short manual and forget all about it. Not a big deal, it was just a demo, and I was already interested in some other things.

That's an interesting anecdote - so did the Finnish army actually use your Pascal compiler? And when you say you were ordered to write a manual for it, where you in the Finnish army at that time?

I was in the University Telecom Lab, but employed by the army in a project to specify a portable texting device, which eventually become the well-known Finnish Army "Kyber"-radiotermimal. I specified the operating system of this non-existing device in my own nokoPascal. This was the time I was playing with my symbolic stack machine, a Forth of sort, but wierd metacharacters which allowed direct execution of "(+ 1 2)" which eventually become Nokolisp. Not a big thing at all -- I just made a Pascal-compiler to this metamachine. http://timonoko.github.io/Nokolisp.htm

Oh yes now I remembered it all. I went to army right after that. But I was a Hippie at the time and concious objector of sort. The inquisition panel found out my objection was not "real" so I ended up as Army Radio Man. But I learned to morse very badly, probably because of mild dyslexia. So rest of the year I was making test equipment for a Russian Missile Control because of language skills ( https://flic.kr/p/JycyMy ). And just occasionally consulting the "Kyber"-team. I did not get any medals or ranks for my contribution, because untrustworthy Hippie with bad hairdo. Also I was rejected from army reserve duties, which was very good.

I was so lucky that for a matter of fate I ended up buying a Turbo Pascal 4.0 book, when figuring out where to move after Turbo Basic.

Eventually I got old of Turbo Pascal 3.0, started learning there (yep a version below), then at school Turbo Pascal 5.5 was actually the programming language after Basic, so I got introduced to units, and Object Pascal.

Eventually due to an agreement with the teacher that if had a theme I wanted to learn more, I could study it and present to the class.

I choose OOP, which in the process made the owner of a Turbo Pascal 6.0 copy, with the wonderful Turbo Vision framework to learn from.

On the same year I bought a copy of Turbo Pascal for Windows 1.5 (target Windows 3.x), with the Object Windows Library, a pleasure to work with versus bare bones Win32.

So when I go to learn C a couple of years later, it never impressed me, too little features, too unsafe, the only thing going for it was being available in more platforms than Turbo Pascal was.

Luckily the same class also had a Turbo C++ 1.0 package that was being ignored, and that brought me the Turbo Pascal features I was enjoying, alongside the portability that Turbo Pascal lacked.

From my point of view, only Microsoft and Apple tools seem to keep on the same developer tooling spirit and language capabilities.

This is the environment where my programming really took off from amateur to, well, less amateur.

It was so fast to compile and so ergonomic compared to the alternatives.

Great stuff.

Me too! I graduated, in a manner of speaking, from FORTRAN, which had no recursion and pointers to Pascal.

Looking back I believe Pascal was the perfect language to learn those two fundamental and tricky concepts. It felt aesthetically pleasing and struck just the right balance between the terse (and sometimes quirky) C and verbose COBOL.

When I coded up those graph algorithms in Pascal I felt “happy” in a way that can’t be explained and which I didn’t experience in C.

Similar experience, I think it boils down to little details handling pointers that are out of reach in C, like reference parameters.

Sure you can emulate them with double pointer indirection, which is anyway what the compiler does, but it adds more cognitive overhead.

Me too! Pascal has a natural "flow" that I lost when I transitioned to C.

Yes, I prefer it over C if I had to program in any of these languages. It feels higher level despite it really isn't very much, just a smidge that will often not matter technically, however it will for a developer.

Me too, with a lot of help from Herbert Schildt books.

My first real project in Turbo Pascal was a system to record the inspection of Fire Protection Equipment in Coal Fired Generating Stations (where small fires break out all the time due to the coal dust everywhere).

I wrote a set of routines to allow field based text editing, and built up a CRUD (Create Read Update Delete) database of locations, routes, equipment. I took 4 weeks instead of the two I estimated.

The customer loved it, it met all the requirements... and was totally impractical as a system. I spent the next year rewriting it in a fairly agile manner working for the Russ, Assistant Plant Manager. He taught me how to make user friendly software in a simple manner... we would pull a person from the plant and say something like

"This is Mike... he wrote this program. [Worker Name], I don't expect you to be a computer expert, it's not your job... I want you to do X,Y and Z... If something goes wrong, it's Mike's fault"

"Press F1 for Help" was ALWAYS at the top of the screen after the first 5 seconds of the first user trying things and not knowing what to do. I learned an amazing amount about writing software from Russ.

One time... he asked "what would happen if I disconnected it right now?" I didn't know, and said so.... I got that taken care of in the next week. You could disconnect at any time, and never lose a record.

It was a fun job.

See also an article about Modula-2 for CP/M from the same author: https://techtinkering.com/2013/03/12/if-only-borland-had-stu...

Discussed on HN here: https://news.ycombinator.com/item?id=16704733

I really wonder how Pascal and the Pascal family of languages, including modula/oberon and ada, how they became niche and how java and c++ took over the world?

Easy answer, UNIX mass adoption.

Long answer,

UNIX spread like fire, because Bell Labs/AT&T initially weren't allowed to sell it.

So the code was given to university, and while they needed to pay for a UNIX license to use it, the price was symbolic versus paying for something like VMS.

Which naturally made UNIX the number one choice for the startups trying to get into the Workstation market during the 90's.

So C started to spread into the 8 and 16 bit computers in some form.

When those 8 and 16 bit home computers, written in Assembly, started to be replaced by more powerful systems, the OS vendors were adopting C as the language.

Most won't be aware of this today, but Microsoft did sell Xenix and MS-DOS at the same time, they sold Xenix as they decided to focus on MS-DOS instead. In fact, MS-DOS 4 failure was an attempt to make it more UNIX like.

At the same time, maybe to reduce costs, the OS vendors started to reduce the amount of compilers they were selling it for their platforms, selling only the same ones as they were using themselves for the OS, which by then naturally meant C.

Any other language started to be available only from third parties, and most of the time without bindings to all OS APIs.

So given the choice of buying the language programming tools from the OS vendor, with everything ready to code, or paying even more (you would need the OS SDK anyway) and having to code bindings, the majority stayed with OS SDK only.

As C++ is a C sibling, coming from UNIX birthplace, it quickly found a place among C compiler vendors tooling.

Java, well it was pushing by Sun, quickly adopted by Microsoft, IBM and Oracle on their platforms.

So enjoyed a bit that extra love from platform owners.

Having lived through this evolution, I have learned only to bet on platform languages, or those that eventually get blessed by platform owners on their official SDKs.

> Easy answer, UNIX mass adoption.

On Unix mass adoption...

My best friend (and still best friend to this day) in the early 90s had an SGI Indy at home (his stepfather happened to be the director of SGI Benelux) and so I got to play with one of the earliest SGI Indy. What a machine to have, for teenagers into computing, at home in the early nineties!

The shock, the world of difference between a beige box running MS-DOS / Windows 3.1 and stuff like (Turbo) Pascal compared to that amazing SGI workstation...

I saw the future, I saw "my" future when I got to play on that SGI Indy. And then when I discovered Linux (back when it was shipping on a CD attacked to a book/magazine) I got to transform my MS/Windows beige PC into a (modest) Un*x station and never looked back (I'm using Linux daily since that day).

I don't have bad memories of programming in Pascal but both Pascal and Delphi felt, to me, like deeply attached to the MS ecosystem and a bit toy'ish (making it easy to do easy things, but very hard to make anything a bit advanced).

As soon as I found a way out of the MS world I was out and so I was done with Pascal/Delphi.

My first UNIX was Xenix, on a PC carried into the class once a week, that was then shared in turns between students.

Hardly impressive, with its green phosphor terminal.

SGI was interesting, then again I guess you didn't had much contact with Atari and Amiga scene back then, right?

Object Pascal dialect was originally created by Apple in collaboration with Niklaus Wirth (see clascal), used to write the Lisa and Mac OS operating systems (naturally they also had their share of Assembly, like UNIX also does).

They only switched to C and C++ after market pressure to have some compatibility with them.

Well, Turbo Pascal was simply not available on Linux, at least not "freely". I loved Turbo, and I missed it and I begrudgingly switched to C++. And as a side note, I hated g++ cygnus to the bones, because they had some fixes for c++ templates that were not yet released in the foss version, only in the "pro" release.

Oh how I missed Turbo for Linux...

Yes, that one of the triggers for me to eventually go into C++ as my next "to go language", I saw C the same way that Bjarne felt about BCPL when forced to leave Simula behind.

Interesting paying for cygnus stuff on Windows never occurred to me, I rather spent my money with Borland and Microsoft compilers.

SGI's were amazing! In one of my first jobs out of college (mid 90's) I had an SGI Indy on my desk. The company was a DEC shop and nobody wanted to deal with it. I used it mostly as an X terminal. A couple years back, I bought an O2 off of Ebay.

It also didn't help that Berkeley Pascal for BSD was terrible. Made a subroutine call for every subscripting operation. This discouraged using Pascal on UNIX.

Really? Yeah Pascal UNIX compilers were quite bad.

When I got into university, I had my first set of Pascal classes on UNIX.

Coming from a background of multiple Turbo Pascal versions, I was on TPW for Windows 3.x by then, I was dismayed having to do university assignments in P2C, using original ISO Pascal (it wasn't even capable of the ISO Extended version).

So no wonder that Pascal on UNIX hardly got any love.

I think only HP-UX and VMS Pascal variants were actually relatively good.

Interesting that you would say that. I've taken the opposite approach to prefer languages that have multiple implementations, platform-independent specs, and a focus on portability, like C, JavaScript and very few others. Also Java/JVM, which at least fulfills this criterion on paper (and pays the bills). Guess it's a matter of whether you're working primarily on the server or client side.

Being platform languages doesn't mean they lack multiple implementations, platform-independent specs.

All the ones I currently use in some form, Java, .NET languages, C++, JS, SQL, fulfill the above via ISO, ECMA, or official reference docs managed by multiple vendors.

And to be honest, even those that don't I really don't care any longer, because most of the code I write isn't mine to own rather the employer, so as long as it fulfil what the customer is after, I am good, when the project is done I move to the next challenge.

If project requires cross platform capabilities, then usually something along the lines of what is available across all platform SDKs gets chosen.

Free and Open Source languages cost less than commercial languages.

I remember that Janus Ada for DOS cost thousands for a license. Java and GNU C++ were free.

Now Microsoft has the Community edition of Visual Studio for free C#, Visual BASIC.Net, C++ and other languages.

Just an amusing anecdote, I learned Pascal in 1982, but also some limited exposure to C. At the time, I was absolutely dead certain that Pascal would win out over C. While I understood what was happening under the hood, the business of programming by doing math on pointers seemed like such a bug factory that I dismissed it out of hand.

Today when I program in C (thanks to embedded work), it seems like many of the modern improvements to the language consist of making it more Pascal-like.

Both UNIX and Windows used it for their operating system APIs.

If you wanted to play in those ecosystems, you had to learn C at the beginning. People wanted to play in those ecosystems. :)

My theory is that programmers love complexity and gravitate to more and more complex things over time. If something is complex and never complete your job is assured to be there tomorrow. C++ has a performance advantage but Java and C# do not.

All the languages that are “strangely popular” have had major backing from a global/multinational company.

It’s not a meritocracy driven development, it’s marketing 101.

Go is to Google what Java is to Sun/Oracle. History is repeating but we can’t really fight it because it would be a wasted effort.

I learned Pascal with Turbo Pascal on CP/M sometime around 1983 or 1984. IMHO it was the best software development environment for that platform. It was full featured, very fast (both compilation and run-time), and very memory efficient.

I also had Microsoft CBASIC, Fortran-80, COBOL-80, BDS-C, and many assemblers. Turbo Pascal put them all to shame. The C compilers for CP/M could not even do floating point math. Turbo Pascal had no such limitations.

Turbo Pascal is great and I love the fact that it uses the Wordstar key combinations. I wish that there was a version for 8080 but I understand why they went with the Z80. Borland went on to create Turbo Modula-2 for CP/M which was very similar to TP but with lots of language enhancements and faster execution time of the resulting binaries. However, it was released quite late in 1986 and quickly withdrawn.

I was the co-author of Turbo Modula-2 for CP/M. It was quite a capable system to fit in less than 64K. Great memories.

At the time Borland intended to develop their own version of Modula-2 for IBM PC, so they bought ours as a complement for the CP/M versions they were still covering. But the in-house version got delayed a lot. It was eventually released as Topspeed Modula-2 several years later, from a spinoff. If Borland had let us also do the IBM-PC version in around 1984, maybe history would have changed and Modula-2 would have become more popular.

Kudos. I loved M2. I haven't replicated the sublime satisfaction I enjoyed from writing M2 since, in any other language. I felt like I could produce most any business solution with it, one module at a time.

University of North Dakota used Modula-2 as its language for CompSci starting in Summer 88 (not sure when they switched away from it). I get the feeling some of the decision was because they had a version running on the IBM 370 under CMS. XEDIT was an interesting editor.

I liked it but remember the I/O commands were frustrating as heck. It would be interesting to C-syntax it and see what the reaction is.

It's been a long long long time since I heard anyone opining one way or the other on the classic 1970s dilemma of whether to stay compatible to the 8080 or use all those cool new Z80 instructions considering that the Z80 was kicking Intel's butt in the 8 bit CPU market!

It's mainly that I just prefer programming in assembler on the 8080/8085 - it's easier to fit the instruction set neatly in my head. The 8085 is also much easier to emulate and I like the ease of interfacing it with hardware. This preference tends to colour everything I do on CP/M.

I understand. So many years ago I built a fast CP/M emulator using a novel scheme. How did it go now, I remember; lodsb mov ah,al jmp ax. So just three instructions none of which affected the flags. So no need for lahf/sahf. The downside was that I needed 64K to sparsely store my opcode emulations. Opcode 0x00 at 0x0000. 0x01 at 0x0101. 0x02 at 0x0202 etc. In each case the code would just be the direct emulation of the 8080 opcode followed by lodsb mov ah,al jmp ax. Opcode 0xff was a manageable problem. But yes, I just did the 8080 instructions, and I remember now that most CP/M software was fine with that, the Turbo Pascal software was an exception.

Currently writing a CP/M game in Z80... I forgot in 40y how hard assembler is to write and how nice a revolution something like TP is.

I first learned BASIC in high school, learned Pascal shortly after that.

I think a great thing about Pascal was its origin as a teaching language. As a result, the textbooks placed a heavy emphasis on learning good programming techniques, and the language supported those techniques. I think maybe it's no mere coincidence that good teaching tools also become good general tools for those of us who are not destined to become full time pro's.

Learning BASIC and Pascal side by side was a great lesson in how to write good code, because you could make your Pascal programs so much more readable and organized. Even today, if any human has a faint hope of reading and using my code (in Python or C), it's thanks to the skills I learned from Pascal.

When I got my first computer, a non-PC-compatible MS-DOS machine, I remember my dad asking me some vague questions about it. He had heard us talk about Pascal (my mom and brother both learned it), and the Wall Street Journal had a glowing article about it. He had no idea what it was, but got me it for my birthday. And it followed the "rules" of MS-DOS, so it ran on my weird computer! No graphics, but who cares, I was up and running with Pascal.

I found a magazine article on how to attach a serial port to my computer, wrote a terminal emulator in Pascal, and found an old 300 baud modem. I was able to complete my computer assignments from my dorm room. In FORTRAN.

Oh, the tricks I pulled off with TP back in the late 80's-early 90's. Paged memory managers, HP inkjet and pcl libraries, text window managers, parsers, compressors, sorts and searches, my youngest son as a toddler thinking the 3.5 floppy on my work machine was a slot to put quarters...Fun stuff, good times.

Was a great tool and incredibly fast for its time. May have been the only thing fast on an 8086...

Turbo Pascal was my first programming language, I remember hacking together small games with it and sharing them at school on floppy disks.

It's a shame what Embarcadero has done to Turbo Pascal's successor Delphi. It's really an amazing language if it weren't for the god awful IDE.

If you're happen to still work on Delphi enterprise software I'd highly recommend to have a look at OmniPascal (https://www.omnipascal.com/), a very smart VisualStudio code plugin. It's a gem that provides JetBrains-like quality completions/refactorings for Delphi/Pascal.

My assumption is that a HUGE chunk of developers around my age (50) started out with line-numbered GWBASIC or similar, and then had Turbo Pascal as their first "real" language.

I have had a million technical books in my life, and I held on to many of them for a long time past their technical viability just out of sentimentality. Now I limit myself to half a shelf. On that shelf are my well-worn K&R, a similarly dogeared very early O'Reilly Perl book, the Peter Norton Assembly Language Book for the IBM PC, and a Waite Group book on Turbo Pascal 5.5.

When I was in high school, I wrote lots of stuff in BASICA and spent long hours with printouts spread over the floor, tracing through GOTOs to figure out what was going wrong. I'd seen articles about "structured programming" and felt it would stifle my creativity.

One dad Dad brought home Turbo Pascal. To try it out I implemented Conway's Game of Life. Once I got past my syntax errors, I was shocked when it worked correctly the very first time. I never wrote another line of BASICA.


I learned programming in my own time on 1980's 8-bit machines, but in college it was Pascal on Vax VMS then Turbo Pascal on, IIRC, an Act Sirius. Loved the language.

Then along came JPI TopSpeed Modula-2 (Pascal++ [joke]) and even though I now do C#, Go, Node, Python, Ruby, and FreePascal, nothing matches the sheer productivity and performance that TopSpeed provided. And their IDE was incredible at the time (though Turbo Pascal 3 having a compiler and editor in around 40KB was technically more awesome).

Yeah I have to say if TSM2 had been maintained I'd still be using it. It was badass. Remember that green thread car traffic demo? That was cute. It's unfortunate the tyranny of C never let M2 break through. Opinion is that the software world would would be in better shape now if M2 had gotten a real foothold.

> Remember that green thread car traffic demo?

Indeed - I still have the software (though the disks are long gone). A few years back I even rewrote that demo in C# (console app) because why not.

Edit: Anders Heljsberg is responsible for C# and TypeScript. Prior to that he wrote what became Turbo Pascal and was chief architect on Delphi. Seems I can't escape his stuff.

I bought this (back in 1986 I think) and used it on a Tatung Einstein running CP/M. I absolutely loved it and went on with TP 4.0, 5.0, 5.5 and 7 then switched to Delphi.

Good old memories. I have earned my first money from Turbo Pascal.

I was blown away when Turbo Pascal 7 came with syntax highlighting.

I also spent days trying to fix infamous Runtime Error 200.

My first exposure to programming came in college in 1998, we used Turbo Pascal to learn programming concepts. It absolutely went over my head at the time, I just couldn't grasp it for the most part! And there began my life long journey to understand this thing called programming! Over 20 years later and I am still bamboozled and confused frequently, but it's my living these days!

It worked on a Commodore 128 and 1571 drive in CP/M80 mode. I used to program in it way back when. Cheaper than C64 Pascal.

Hmm, I started reading the Wikipedia article on the Pascal programming language. I was reading about the pointer types and saw a 'with' statement... Where did I see something like that before?... Yes, JavaScript! Where it is highly discouraged to use. How is it like in Pascal?

C++ class scopes have the with problem.

   class foo {
     // int x;
     int y;
     int bar();

   // in another file

   int x;

   foo::bar()  // "with whole friggin class scope ..."
     return x + y;  // global ::x plus class member y
Now uncomment the x in the class declaration, and the x + y now adds two class members.

Which is why C++ has a global scope operator.

Note that it's alluded to in a comment in my comment.

The scope operator is an ugly opt-in mechanism you will only use if you discover the problem.

As I remember it from nearly 25 years ago, with was a safe and straightforward construct to use, as long as you kept it within manageable scopes. Great for saving an extra dereference inside some monster loop when the microseconds really counted.

It is discouraged in Pascal as well. Can give really nasty surprises with scoping / debugging. Well to me it is mostly gossip as I refuse to use WITH in my Pascal code so no practical experience.

It’s different in Pascal l, iirc: in JavaScript with has dynamic scope in and affects every function you call inside the work statement; in Pascal, it has lexical scope. I used it all the time in Delphi and don’t recall any real issues.

The Pascal/Modula-2 WITH statement brings all of the members of a record into the lexical scope, without them being mentioned in the statement (i.e. implicitly).

So when you add, remove or rename members of a record, you are potentially influencing the contents of scopes in other files all over the project. You can cause variable shadowing that way.

     B : INTEGER;

     A := B;  (* B is just a local, A is a field *)
If B is added as a field, the above suddenly means ^P.A = ^P.B.

Any time you edit a Modula-2 record, you have to search the program for all the places where its type may be targeted by WITH.

Probably if you stick to some rules, like never using WITH on another module's record type, you will be fine.

Diagnostics related to shadowing could help.

I assume it’s statically checked, so you’ll get a compilation error?

It is a habit. I use Delphi all the time even now as one of my currently active projects is written in it. I just do not use WITH.

Meh, you do have to watch your scope using "with," but it's worth the brevity provided if you write pascal code crafted to be sensitive to unit/class/record dependencies. If I was putting together a team, it might be prudent to include some coding governance around "with" I admit.

Heh, thought it was from Lisp. No problem with scoping there.

with macros in Lisp tend to be sanely designed: they explicitly list the symbols that are to be introduced into the scope. I don't think I've never seen a "bring the whole set of the currently defined slots of this class/struct into this scope as locals".

Oh, you can do it.

  his is the TXR Lisp interactive listener of TXR 249.
  Quit with :quit or Ctrl-D on an empty line. Ctrl-X ? for cheatsheet.
  Use full-strength TXR for tough tasks, or dilute with shell scripts.
  1> (defmacro with (struct obj . body)
       (with-gensyms (obj-sym)
         ^(let ((,obj-sym ,obj))
            (symacrolet ,(mapcar (op list @1 ^(qref ,obj-sym ,@1)) (slots struct)) 
  2> (with time (time-struct-utc (time))
       (list year month day))
  (2021 1 30)

  3> (macroexpand '(with time (time-struct-utc (time))
       (list year month day)))
  (let ((#:g0016 (time-struct-utc (time))))
    (symacrolet ((time-local
                 (time-utc #:g0016.time-utc)
                 (time-parse #:g0016.time-parse)
                 (year #:g0016.year)
                 (month #:g0016.month)
                 (day #:g0016.day)
                 (hour #:g0016.hour)
                 (min #:g0016.min)
                 (sec #:g0016.sec)
                 (dst #:g0016.dst)
                 (gmtoff #:g0016.gmtoff)
                 (zone #:g0016.zone))
      (list year month
Total expansion; symacrolet gone, a.b desugared into (slot a 'b):

  4> (expand '(with time (time-struct-utc (time))
       (list year month day)))
  (let ((#:g0017 (time-struct-utc (time))))
    (list (slot #:g0017 'year)
          (slot #:g0017 'month)
          (slot #:g0017 'day)))

I remember using Turbo Pascal in high school, in my AP Computer Science class. This was in the early 90's, running on a PS/2 model 30 (8mhz 8086.) It was lighting fast, even on those low end machines that were several years old at the time! Fun times.

Title should have been:

Turbo Pascal: A Great Choice

My first computer was an old PC XT, ancient even by the undemanding standards of 1995, but cost under 100 USD - which counted a lot in early post-Communist Central Europe with average wage in the 250 USD territory.

I did a lot of Turbo Pascaling on that one, but it was frustrating watching the compiler go so slooowly while I already noticed a misprint or a missing ; on the screen.

The last thing I did on Turbo Pascal was a program that drew fractals in 320x200 using direct memory access (byte absolute). I tried to get it working in 640x480, but the differences between individual VGA cards were too big. That was 386 already, though.

It was so easy to draw simple graphics in pascal, right?

I have this snippet burned in my head and I used it all the time in MS-DOS' on Turbo Pascal 6 or 7 to get to the tasty 320x200 palleted graphics mode:

      mov ax,13h
      int 10h
iirc, after that you could simply directly access video memory using something like "mem[$A000:x+200*y] = color;" and that was it.

Fun times.

> but the differences between individual VGA cards were too big.

Buyed the programming manual for the ET4000 GPU (>100DM for this manual alone, a lot for a student from the eastern part of Germany at this time), opcodes and all. I liked the possibility to easily mix Assembler with Pascal in Turbo Pascal. Machine code for graphics, FPU, interrupt programming, the higher language for anything else.

After that, I learned C from the Open Source Fractint. So, the transition wasn't that painful after TP's decline.

And anything was so snappy in Turbo Pascals text mode windowing system (as with Norton Commander too).

I didn't know Turbo Pascal was available on CP/M. In case it was I bet it's the best language available there.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact