Rare Programming Languages: Why They Matter and What They’re Used For
Modern developers increasingly turn to rare programming languages to address specific project needs. Let’s explore when and how to use them.
Why Rare Programming Languages Matter
Today, the most popular programming languages are JavaScript (used by 25.2 million developers), Python (18.2 million), and Java (17.7 million). However, sometimes a project requires unique code that can’t be written with the top popular technologies. Below is a selection of rare programming languages that many developers have never heard of but which can significantly boost development.
COBOL
COBOL (Common Business Oriented Language) was created in 1959 by Grace Hopper, also known as the “grandmother of COBOL”. Initially, it was imperative and procedural, but since 2002 it has become object-oriented. It gained widespread use thanks to the US Department of Defense and later became popular in financial computing.
“The use of COBOL cripples the mind; its teaching should, therefore, be regarded as a criminal offense.” — Edsger Dijkstra
Dijkstra was somewhat correct—COBOL indeed has a complex and verbose syntax compared to less “wordy” languages. However, it’s excellent for tasks that other technologies can’t handle. COBOL performs decimal calculations with fixed-point arithmetic rather than floating-point, avoiding complex rounding rules like in Java, and making operations faster. Additionally, the code runs consistently on both 8-bit and 64-bit architectures because COBOL can store different types of variables regardless of the compiler and system architecture.
That’s why COBOL is indispensable in financial transactions. In the US, banks and the healthcare system use it for terminal transactions, stock trading, and doctors’ salaries.
Here’s an example of simple COBOL code:
IDENTIFICATION DIVISION.
PROGRAM-ID. IDSAMPLE.
ENVIRONMENT DIVISION.
PROCEDURE DIVISION.
DISPLAY 'HELLO WORLD'.
STOP RUN.
Lua
Lua is a scripting language with source code in C. It’s closest to JavaScript with a similar prototype-based object-oriented model but is more powerful and flexible. Arrays, structures, sets, and other composite user-defined data types are implemented using tables, and OOP mechanisms are through metatables.
Originally developed for the oil company Petrobras, Lua is now used for developing mass-market software, such as the graphical interface for Adobe Lightroom, and games. With Lua, you can easily code NPC (Non-playable characters) behavior without rewriting the engine. Games like Garry’s Mod, Roblox, Stalker, and even World of Warcraft use Lua.
Here’s an example code from “Stalker”:
local members = {}
local moved = {}
zone = nil
-------------------------------------------------------------------------
function add_member (npc)
-- check if it's our guy
local ini = npc:spawn_ini ()
if ini == nil or ini:section_exist ("escape_raid") == false then
return
end
-- if already exists, go away
for a = 1, table.getn (members), 1 do
if members[a] == npc.id then
return
end
end
-- add intruder to blacklist
table.insert (members, npc.id)
printf ("Stalker %s is added to list", npc:name ())
-- remove from the living world
this.switch_offline (npc.id)
end
F#
F Sharp is a multi-paradigm language supporting procedural, object-oriented, and functional programming. Developed by Microsoft Research, it was integrated into Visual Studio 2010 and later versions.
F Sharp features concise code with type inference. It focuses on data, parallel I/O, and parallel computing, often used in scientific research, data analysis, machine learning, and web development. It integrates well with .NET platforms.
Though rare and unpopular, F# can be extremely useful in specific tasks related to Big Data and ML.
Here’s an example code:
module Integers =
let sampleInteger = 176
/// Do some arithmetic starting with the first integer
let sampleInteger2 = (sampleInteger/4 + 5 - 7) * 4
/// A list of the numbers from 0 to 99
let sampleNumbers = [ 0 .. 99 ]
/// A list of all tuples containing all the numbers from 0 to 99 and their squares
let sampleTableOfSquares = [ for i in 0 .. 99 -> (i, i*i) ]
// The next line prints a list that includes tuples, using %A for generic printing
printfn "The table of squares from 0 to 99 is:\n%A" sampleTableOfSquares
R
R was created specifically for statistical data analysis. It was developed at the University of Auckland as a free alternative to the commercial language S.
R’s popularity is growing, and it’s used by many major companies such as Amazon, Deloitte, Accenture, and Google. However, its syntax is different from other languages, making it challenging for beginners. R is a statistical technology first and foremost, featuring functions for data table merging, interactive graph creation, and statistical testing. It can also be used to write web applications using the Shiny library.
Here’s an example code that converts binary code to decimal:
# Program to convert decimal
# number into binary number
# using recursive function
convert_to_binary <- function(n) {
if(n > 1) {
convert_to_binary(as.integer(n/2))
}
cat(n %% 2)
}
Clojure
Clojure is a modern, dynamic, and functional dialect of Lisp on the Java platform, created by Rich Hickey in 2007. It’s designed as a general-purpose language, combining the ease of script development with a robust infrastructure for multi-threaded programming. Clojure is known for its interactive REPL environment and strong support for parallel programming.
One of the key features of Clojure is immutability and the emphasis on functional programming. It also provides access to Java frameworks and can compile to both Java bytecode and JavaScript, making it useful for both server-side and client-side development.
Clojure is used by major banks, such as Raiffeisen, and companies like Netflix, Amazon, and Apple. For example, Apple uses Clojure for data collection and statistics.
Here’s a Hello World example in Clojure:
(ns hello
(:gen-class
:methods [[sayHi [] String]]))
(defn -sayHi [this]
(println "hello world"))
Haskell
Haskell is another pure functional programming language. Named after Haskell Curry, a logician and type theorist, it features strong typing and supports lazy evaluation.
Haskell is known for its simple and elegant syntax, as well as its speed and performance. It’s used in investment banking and for creating system products and software. Major companies like Meta, IBM, Twitter, and Bank of America use Haskell. For example, Facebook* uses Haskell to combat spam.
Here’s a Hello World example in Haskell:
main = putStrLn "Hello World!"
Elixir
Elixir is a general-purpose programming language that uses dynamic data typing and functional programming paradigms. It runs on the Erlang virtual machine, known for its ability to run distributed and fault-tolerant systems with low latency.
Elixir supports metaprogramming, allowing developers to write code that generates other code, and parallel programming. It has powerful built-in tools for testing and debugging software.
Elixir is widely used in web development, particularly with the Phoenix Framework, and in creating distributed and fault-tolerant systems, thanks to the Erlang/OTP platform. It can be challenging for developers unfamiliar with functional programming paradigms, but the benefits include efficiency, scalability, and reliability.
Here’s an example code that duplicates strings multiple times:
"AAA" = String.duplicate("A", 3)
"HELLO HELLO " = String.duplicate("HELLO ", 2)
There are many niche and rare programming languages out there. Even experienced developers might not have heard of them. However, such languages help solve specific tasks when popular solutions are powerless. Share in the comments what rare languages you have used and how they helped in your project development.
In case you have found a mistake in the text, please send a message to the author by selecting the mistake and pressing Ctrl-Enter.