I used ChatGPT to write the same routine in these ten obscure programming languages9 min read
A few weeks ago, I took a look at using ChatGPT to write the same routine in a dozen of the most popular programming languages. But as a programming language geek, I wondered just how far ChatGPT would go. Would it program in a language from the 1950s? Would it program in a language that used its own character set? Could it write code in one of the languages that wrote its code?
Also: The best AI chatbots: ChatGPT and alternatives to try
And so, I dove in. I’ve used many of the languages I’m spotlighting here, so I’ll take a little walk down memory lane and include some stories about my experience with those I’ve used.
While I haven’t run the code itself, I’ve read through all the generated programs. Most look right, and show the appropriate indicators telling us that the language presented is the language I asked for.
Also: How does ChatGPT work?
I’m telling you this because the headers on all the screenshots are wrong. Most are listed as SQL. For some reason BAL is shown as VBNet, and Prolog is listed as Rust. ChatGPT didn’t make this error last time, but it made today, for all the languages shown here.
And with that, let’s dive in.
Fortran (or FORTRAN, as it was depicted back then) stands for Formula Translation. It was developed primarily for scientific and engineering calculations. Even though it dates back to the 1950s, it was often the first language taught to engineering students in the 1970s and 1980s.
Also: This new technology could blow away GPT-4 and everything like it
For me, it was my fourth programming language, after BASIC, PDP-8 assembly language, and PDP-8 binary (yes, I wrote binary code so I could toggle it in on the front panel of an early minicomputer). My Dad generously drove me the hour down to Newark College of Engineering (now NJIT) so I could take their first-year programming course while I was still a sophomore in high school.
Fortran was never a favorite, although it would get most calculation-oriented jobs done. A variation of Fortran is still in use today, but it’s pretty limited to specialty scientific work since many other modern languages do Fortran-level analytics, and do it better.
Here, because of the use of the implicit keyword, it looks like ChatGPT is depicting code written in the Fortran-77 variant.
I was a teenaged COBOL programmer. I didn’t know COBOL at the time, but somewhere around 1980 I saw a want ad for a COBOL programmer at the Northeast Regional Data Center of International Paper in Denville, NJ. It was about 40 minutes from my parents’ home, and I needed a summer job. As soon as I managed to schedule an interview, I ran to the local bookstore and spent a weekend chowing down on all the COBOL reading material I could find.
Also: How to use ChatPDF: The AI chatbot that can tell you everything about your PDF
COBOL was meant for business-oriented processing. Today, the same type of customers would be SAP or Salesforce users. But COBOL, as you can see from the COBOL-88 code below, was functional, but it sure wasn’t elegant.
As it turns out, they wanted a full-time employee. But since I aced their test (apparently my weekend of study beat out the scores of the professionals who applied), they decided to put me to work for the summer. To say there was a cultural mismatch was an understatement. These were the very early days of microcomputers (think pre-PC) and I gloried in that stuff. Meanwhile, these folks were all about the suits and ties and giant data centers. I almost immediately picked up the nickname “Trouble.” Hey, I was still a kid.
The defining moment for me came when one of the more seasoned programmers at the company took me aside to explain, and I quote, “COBOL is life.” I took that message to heart and decided that I didn’t want my life to be about COBOL. That summer was the last time I programmed anything in COBOL.
RPG (Report Program Generator)
No, it’s not a rocket-propelled grenade or a role-playing game. RPG was a program for creating reports. You can see the evolution in the language (and computer language thinking, in general) between the two versions shown below. RPG II dates back to the late 1950s. RPG IV was updated in the 1990s, and is considerably more modern (but still definitely dated).
I did write a few RPG III programs for the AS/400 as a side gig while in college, but it was never anything I followed all that closely.
I have a long love affair with Lisp. Lisp, named for LISt Processor, was sometimes described as Lots of Insipid Stupid Parentheses. For some reason, those parentheses clicked in my brain. Lisp was my gateway drug into AI programming, and as we’ve learned from ChatGPT’s processing of language, knowledge can be represented as strings of words, or lists.
Also: ChatGPT’s intelligence is zero, but it’s a revolution in usefulness, says AI expert
Back in the 1980s, I was a product manager for a RISC-based Common Lisp implementation, and coded in it for a while. Based on the defun greeting and let syntax generated by ChatGPT, it looks like the code below is also Common Lisp, a later variation of John McCarthy’s original Lisp implementation of the late 1950s. McCarthy was one of the founding fathers of AI research, so it’s only fitting that an AI should write in his language.
ALGOL (ALGOthymic Language) was ahead of its time. It allowed the passing of functions as parameters, and allowed the use of recursion. These are two key components of modern programming that were absent from popular languages like Fortran and COBOL, which were popular at the same time of ALGOL’s introduction.
Simula, as you might imagine, was developed for simulation and modeling. Like ALGOL, Simula was also ahead of its time, supporting the use of objects and classes. Object oriented programming has since become fundamental for many of today’s most effective programming languages.
The use of the keyword OUTFIX tells me that ChatGPT probably wrote the following code in Simula-67.
BAL (IBM 360/370 assembly language)
BAL, which stands for “basic assembly language,” was the assembly language for big IBM iron back in the 1970s and 1980s. Assembly language is considered more “lower level” than “higher level languages,” meaning that individual instructions and keywords map to individual processor instructions. In higher level languages (like most we use today), the language is often far removed from the underlying machine architecture, and is designed more for efficiency of programming than efficient use of hardware.
Also: Generative AI is changing your technology career path. What to know
I took a semester of BAL in college. It was rough. The professor spent most days standing with his back to the students, mumbling his lecture in a monotone, while writing nonstop on the blackboard. I sat in the back row next to a girl named Laura. One day, Laura and I decided to sneak out the back window to get coffee. Once we got our java, we climbed back into the window. The professor never noticed.
It’s a wonder any of us passed, but it’s no wonder that virtually none of us took up BAL programming as our coding weapon of choice.
APL, or A Programming Language, is another programming language. One of the most striking aspects of APL is that it uses a non-standard character set for some of its operators and coding. You can see that in the image below. The little glyphs are what ChatGPT was able to pull up from the font it was using, but APL is designed to use the APL385 Unicode font, which is unique to programming in APL.
Also: How to use ChatGPT to write Excel formulas
Because of how it has a concise syntax, and manages large datasets well, it’s used in a fair number of scientific, financial, and analytical projects.
Prolog (which is derived from the phrase Programming in Logic) is another AI-focused language. Prolog is a declarative language, listing rules and conditions, and then running queries over those declarations. According to ChatGPT:
Prolog is one of the programming languages used in the development of ChatGPT, specifically for the generation of text. It is used in the Prolog-to-English module, which translates logical forms in Prolog into natural language sentences.
Smalltalk is special. It was developed at Xerox PARC, the same research lab that influenced the development of the mouse and windowed environments. It incorporated some of Simula’s innovations in object-oriented programming and went further. It also was one of the first languages that made active use of a GUI-based interactive programming environment. Many of today’s top languages, including Java, Python, and Ruby, were highly influenced by Smalltalk.
Also: Okay, so ChatGPT just debugged my code. For real
I only dabbled in Smalltalk, mostly to get to know it. Living in Silicon Valley at the time, I got to know the designers of Smaltalk, who later spun off ParcPlace Systems, in an attempt to commercialize Smalltalk outside of Xerox’s corporate stodginess. I have many fond memories of talking programming theory over ribs and coleslaw at a little run-down barbecue joint in Palo Alto.
One of the VPs I worked with at the computer company where I was employed tried to talk me into starting a company with him to apply Smalltalk to the enterprise market, but I hadn’t yet been bitten by the startup bug. Smalltalk never made it as a market. Still, as happy as I am with the path my life has taken, I sometimes wonder what would have happened if I had taken him up on his offer.
I have thoughts
Also: I asked ChatGPT to write a WordPress plugin I needed. It did it in less than 5 minutes
We do know there’s at least one error in each example: the headers are wrong. So while the ability for the AI to generate code in a bunch of relatively obscure languages is cool beyond belief, don’t assume it’s doing the entire job correctly.
If you decide to incorporate ChatGPT programming into your workflow, you’ll need to check, test, and debug the code it generates just as you would if you hired someone to write some basic routines for you.
You can follow my day-to-day project updates on social media. Be sure to follow me on Twitter at @DavidGewirtz, on Facebook at Facebook.com/DavidGewirtz, on Instagram at Instagram.com/DavidGewirtz, and on YouTube at YouTube.com/DavidGewirtzTV.