Turbo Pascal Compiler in JavaScript
github.com
github.com
In 2021, I'm writing programs for iOS in React Native. I need Xcode that weighs in at ~8GB _compressed_, node.js, and RN plus the whole slew of dependencies. On my 2020 Intel Mac mini w/ 32 GB of RAM, Xcode takes multiple minutes to build just the native part of the project from scratch.
Where, where on earth did I go wrong?
It's easy to feel a lot of nostalgia, but those truly were simpler times when we expected a lot less of our computers/programs.
Sure they didn't scale as much or have embedded video, but in terms of "did they do function X"? Yes they all worked fairly well.
The massive horsepower gains are REALLY noticeable in the evolution of games. But outside of that in "productivity"... ye gods we are wasting horsepower to basically do the same crap we used to do.
What is really really exasperating is when any app freezes for multiple seconds. I start counting 4 billion... 8 billion... 12 billion (assuming 4 billion instructions per second). How does that happen with having 1000x the horsepower?
And the RAM we waste these days. Windows ran in 4 MB! And 16GB is too small these days for development?
Moore's law is dying. Software stacks need to start optimizing themselves.
Word for Windows almost certainly supported embedded videos. WordPerfect for Windows certainly did, and I seem to recall it being based upon OLE (a Microsoft technology). This was in the Windows 3.1 era.
> ... but in terms of "did they do function X"? Yes they all worked fairly well.
The answer is truly an, "it depends." Some modern software is much more powerful. Other software feels like a throwback to the 8-bit era with a shimmering veneer. I used to think that this was a product of web and mobile development effectively forcing developers to start again from scratch, but I am starting to believe that most modern developers lack the ability to implement features that aren't provided by a framework.
Don't get me started on icons. Icons, if anything, have gotten progressively worse somehow with more resolution and colors. It's almost like the reduced color palette caused more sudden color transitions and communicated the icon's purpose back in the day.
Which might have underpinned material design... but that entire movement, at least its major expressions (e.g. Windows 8/x) is an utter disaster.
But sure there is software that does a lot more as well, luckily we did progress.
But don't forget there are millions of (mostly Windows) programs in the world which could've been (and are still!) from that era or long before (Cobol machines in the basement).
I do remember WordPerfect (the DOS version) being absolutely incredible... in no small part because you could "reveal codes" (or whatever the name of that feature was). I helped my dad produce a couple of textbooks using WP and the most difficult thing we ever encountered was... printer drivers. (Which is still a pain point today if you're not using Windows/Mac.)
30 years later, I love writing markdown and stay away from GUI rich text editors as much as I can.
There was also overlays[2][3] and extended memory (EMS/XMS) which made it possible to use quite a lot of memory.
[1]: https://ilyabirman.net/meanwhile/all/ui-museum-turbo-pascal-...
[2]: http://www.oocities.org/~franzglaser/tpsrc/overlaytxt.html
[3]: https://secondboyet.com/articles/publishedarticles/theslithy...
Saving stuff to harddisk with 8.3 file name notation and working on super-crappy monitors is still a dealbreaker, not to mention Git.
I recently wrote a little demo on Amiga 500, 68k Motorola. And it was excruciating.
Today's software development is sometimes unfortunate, but I find the benefits more remarkable than in the 90th.
Most of the React Native code I have seen is just presenting customized widgets to the user, and being a front-end for an API.
It is difficult to compile a RN project from a year ago, and very difficult for a three year old RN project.
By contrast, I wrote a paint program in Java almost 15 years ago, and it ran comfortably on a 486DX4/100 machine. And it will run without any modification on a computer today.
git clone https://github.com/unqueued/SimplePaint
cd SimplePaint
make
java SimplePaint
Generating a jar file (make jar) creates a distributable that is 26K.I've written fairly sophisticated business logic in Visual Basic 6, and I remember how much less cognitive load there was developing it. In the early 2000s, it was no problem to interface with a variety of different databases and APIs.
And like Java, most of these programs will probably run on Windows 10 with no modification.
One thing I really miss is how much less room there was for things to go wrong. Even in Visual Basic, the primitive threading support was so much simpler. Even when dealing with data streams from various sockets, handles, and the GUI, I spent maybe 1/10th the time as with React Native.
Of course I appreciate that React Native can do some unique and cool stuff. But I find that in practice what it is used for is stuff which could have been done so much better with other technologies.
The tools of the past still work blazingly fast on current PC. But look closely, a database such as postgresl is really light on resources and goes very fast for workloads of the 90's (or event SQLite). A C compiler with make goes fast too. Except your code now runs on a multiprocess operating system with tons of security, crash proof stuff (remember rebooting your PC because an off by one in your C code ?, remember fiddling with CONFIG.SYS to be able to use stuff about 640KB ?). A compressor is way faster than before. Stuff like Maxima are so much better now...
The only thing that has inflated is UI. But as far as UI for coder are concerned, things are good today I think. I use emacs, it still rocks. I use IntelliJ and it's pretty fast + it has code refactoring, code navigation and other wonders. Sometimes I write Jupyter notebooks, have you ever saw that ? It's incredible how much powerful that is to explain ideas. Of course I could do it with pen and papers, but I have so much more comfort to do it now.
So it's not that bleak :-)
One more example, I write demos for Apple 2+ from time to time. And guess what : do I code them on the Apple 2 ? No way, 40x24 display ? floppy disks ? crashing computer ? No git ? No good text editor ? No browser ? Nope, I would never code on an Apple 2+ today. But coding on today's tool with Apple2 as a target, that's waaaaaay better than in the good old days !
I hit those limits writing a battletech game in Turbo Pascal.
And not exactly doing optimization...
But yeah, Turbo Pascal really makes you wonder where all the horsepower (LITERALLY 1000x more speed or more with multicore and all the branch prediction, spec exec, ops fusion, out of order exec, etc) is going.
And 4MB ram. That fits in CPU cache and then some!
Library bloat is so out of control.
Here.
> I'm writing programs for iOS in React Native
Try Firemonkey from Delphi. It will allow you to write cross-platform applications, though for iOS/Mac you'd still need XCode, but at least you'll compile in seconds a small/medium application.
From what I remember of TP6 it would take me a few years. Maybe even a decade. Oh and a lot of libraries (like mouse support) used assembly code and prob only worked on a limited numbed of computers.
Are we talking about the site, or the web browser to view it with? I could probably do either in a month.
Using Lazarus/Free Pascal, about 1 week each.
Obviously to get there you first need to get all the iOS UI kit into Pascal. Then also a compiler from Pascal to iOS binaries.
PS: don’t forget the dev tooling.
> My friend Fredrik Fatemi and I spent the summer after high school (1989) writing graphics programs in Turbo Pascal on his 286 PC (with EGA!) in his basement while watching The Princess Bride again and again on his VCR. He recently found some 3½" diskettes with our programs on it. I couldn’t find a good way to run them on my Mac, so naturally I wrote a Turbo Pascal compiler. It’s web based and you can try it here.[1]
[1] https://www.teamten.com/lawrence/projects/turbo_pascal_compi...
Dosbox / Boxer
Sometimes it is awesome when the right person doesn't know something.
Missing the point that it is a brilliant teaching language for a beginner to learn fundamental concepts.
I am currently working on NIR spectrometer and I am actually thinking about using Lazarus for driving touch screen instead of web based dashboard.
https://www.lab-services.nl/en/home
In Germany, there are still conferences with Delphi contents (EKON 24 and BASTA), and some magazines have occasional Delphi content.
And Wirth's "Compilerbau" (Compiler Construction) booklet (about the size and less than the weight of a bar of chocolate) is a true gem; it makes it all look very simple.
Compared to C? Yes, obviously.
Compared to languages we have now? Not so much.
Python elegant? Probably you meant easy to learn, but elegant is something else entirely. Not to mention is still interpreted (though for the life of me I can't phantom why none writes a compiler for it. Would be a huge advantage)
Haskell is the only one that I would call elegant on this list. But we were talking about modern. Haskell is 30 years old, I would not call that modern. Also Haskel and Lisp can be written (just like C macros if you want) to birth an entire different syntax if that's your kink.
> Haskell is the only one that I would call elegant on this list. But we were talking about modern. Haskell is 30 years old, I would not call that modern. Also Haskel and Lisp can be written (just like C macros if you want) to birth an entire different syntax if that's your kink.
The only mention of 'modern' in this thread was with respect to Java... you know, the one with record types which eliminate a lot of boilerplate?
I'm not sure why age should count against Haskell, when you agree that it is 'elegant'? I should point out that the Haskell of 30 years ago is very different from Haskell today.
I'm not even sure what we're arguing about at this point.
Pick your poison:
PyPy https://www.pypy.org
Cython https://cython.org
Nuitka https://nuitka.net
What choices do I have? One would be to rewrite the solution myself using provided Python code as base. Second would be to get the Python code compiled in a .dll(Win)/.so(Lin) and use it.
Can above poisons do that for me? Answer: NO. I tried all 3 already, they do. not. work.
Otherwise I can definitely call Powerpoint2Exe an interpreted language too since it can generate a standalone executable.
But to solve the problem you describe, you can:
1) embed CPython in your app to run the Python code (i.e. link with the libpython DLL), and then
2) modify the most performance-critical parts of the Python code so that they can be compiled with Cython or mypyc (or write them in C using the Python C API).
When every variable and field access involves a hash table lookup, the interpreter loop is not the primary performance bottleneck.
Subsetting like this is so underrated. In case anyone is wondering why one person could do this without an engineering team, and act like it was so enjoyable ;-)
Oh well, cool achievement anyway. Playing with it right now.
Amazing, I don't know how many years (decades?) I haven't used it, but some keybindings are still in my memory!
I was contacted in 2004 when it stopped working... because they had inadvertently swapped the two IO cables when replacing the PC it ran on. Y2K had zero effect on it.
Free Pascal tries to be compatible with Turbo Pascal and is ported to dozens of systems.
Of course, it’s the natural thing to do. Amazing, writing a compiler
I lost all of my TP programs from '92-'02 as the result of a dramatic neglicence.