If car technology had advanced as quickly as computer technology, a Dodge Viper would cost $3.99, get a million miles per gallon, and explode twice every year.
*Note* This article is merely for amusement and partial education purposes. It is not intended for a general audience, but those who have at least basic programming knowledge. (Ex. the concept of object-oriented programming) Also, this is not meant to be a particularly serious nor an absolutely precise / advanced article. It is also my first. So please excuse the fact that I used Wikipedia, a sometimes unreliable source, several times and that I may not have anything good to share with you. If you find problems, feel free to rate this down and comment with insults. This is just something interesting and odd.
I will be introducing:
1)Whitespace - one of those joke programming languages used as nothing except as a joke or a challenge (if you don't know what I mean, you'll get it when I tell you)
2)Scala - a very useful programming language based off of and interoperable with Java, more strongly OO (object-oriented) and incorporates functional programming
3)Scheme/Lisp - a well-known older programming language from before Algol, Algol being the ancestor of more modern-day popular languages such as C and Java, which in turn influenced many other languages
Each language will have an introduction, some sections about properties resulting from unique/unusual concepts/features, a conclusion, and some reference/further reading links. Some of the conclusions are biased or unreasonable, but if they're opinionated and you don't like it, then you are opinionated also. Think about it.
1. Whitespace
Whitespace was invented by 2 university students and released on April Fools' Day of 2003. It is not a particularly high level language for a simple reason, also the reason for why it is so unusual compared to popular programming languages : its syntax consists entirely of whitespace. That is, it ignores everything but whitespace. As you know, whitespace is generally ignored in most popular programming languages to give programmers the freedom to format their code however they want. Whitespace is just that : any character that is white space. (tabs, line breaks, and spaces) A series of different spaces is literally the only syntax, much like machine code consisting of only binary bytes/bits. In fact, this is a highly relevant analogy, because Whitespace syntax corresponds to separate bits in binary. (space = 0, tab = 1, new line = new byte) 2 empty lines mark the end of code in a file.
Properties Resulting from Syntax
As mentioned earlier, Whitespace ignores non-whitespace characters. Because of this, it is usually invisible unless properly syntax highlighted. Comments can also be placed absolutely anywhere, provided you don't use any kind of spaces to write them. Code from other languages can also be used as Whitespace code, because of each language's opposite syntax. Therefore, a perfectly running application in C++, interpreted as Whitespace code, may also run fine. This leads to another interesting property : Whitespace code can be hidden as code of some other language. Thus, an irrelevant application that seems to perform high level encryption, which appears to be normal, may actually be hiding a large amount of whitespace... Which can in turn be used as the simple code of Whitespace. So, you can hide any Whitespace program inside another program, without malfunctions or obvious giveaways to anyone just looking through.
Conclusion/Summary
Whitespace is not a mainstream language conceived for programming large projects or even for any use at all. It is mainly for amusement, perhaps to hide something, and for the challenge of translating, in your mind, first to machine code, and then that machine code to whitespace (or Whitespace). Check out the below links for more info.
This language is only unusual to those unfamiliar with functional programming. But more on that in a second. First off, Scala is based in Java, a popular modern-day language, which was heavily influenced by C++. Scala enforces object-orientation more strongly than Java, an example of this being its primitive types (int, boolean, double, etc.), methods, and operators (+, -, etc.) all being classes/objects. Scala also allows for singleton objects, basically classes instantiated only once in the duration of runtime, and, again, functional programming. This is one of the most noticeable differences between Scala and most others. Functional programming is basically where functions are the most emphasized concept in a language, with various features that accompany this concept. In a nutshell, all functions are objects, and objects are values. Functions are basically treated as values. You can "pass functions as arguments, store them in variables, and return them from other functions," as quoted from the official Scala tutorial. Note, however, that functions are not quite the same as methods in Scala. On the differences between these, I suggest going to link 3 for this section.
Properties Resulting from Functional Programming
Because the main "new thing" in Scala is functional programming, at least to most mainstream programmers, that's what I'm going to discuss. However, Scala also has other unusual features that may be of interest, which you can find out about at the linked brief Scala tutorial (official). Now, for one thing, you no longer require a loop to repeat an action. Functions can call themselves and return themselves, so you can recursively repeat an action without using a loop. Another property coming from the combination of OOP and FP is functions that contain methods and that can be inherited. Because FP is a rather difficult concept to grasp and its full measure is beyond the scope of this article (not to mention some of its details escape me), I will only refer you to the links for further reading.
Properties Resulting from Absolute OOP
While this might not be completely new, it introduces one extreme feature : the ability to change or inherit traits of each primitive type and operator. You can add new functionality to the language itself by doing so. Freaky, isn't it? (Scheme/Lisp is even more so in this way)
Conclusion
This language is difficult to explain, and I'm sure functional programmers have no need for any explanation. Nonetheless, it's not quite mainstream, so I find it interesting and worthy of sharing. It also has another unique ability I mentioned lightly : it interoperates with Java. That is, computers with the JRE (Java Runtime Environment) installed can run Scala applications, and Java/Scala applications can call each other's methods, import/inherit each other's classes, and coexist in a single Java package. Combined with its Java-like syntax, this makes it very easy to integrate Scala into any existing Java project or vise versa.
Perhaps the strangest yet most popular of the 3 I am informing you of, is Lisp. Scheme is one of the currently popular dialects of Lisp, so while interchangeable, they are not exactly the same. Lisp (LISP) comes from "LISt Processing", and its source code and main form of data both come as linked lists, a data structure. I recommend Google'ing that. All statements are expressions in Lisp, and was the first language to implement "if-then-else" statements, as well as the first to create a self-hosting compiler, that is, Lisp code was compiled that was able to compile itself.
Properties Resulting from Linked Lists
First is Lisp's parentheses. It's parenthesized due to its linked list format. This makes it obvious when code is written in Lisp or a dialect of Lisp, because it looks kind of like:
CODE :
(defun factorial (n)
(if (<= n 1)
1
(* n (factorial (- n 1)))))
This is an example from Wikipedia.
Also, Lisp can actually manipulate its own source code as data, because of how they are both linked lists. So developers can actually change Lisp as a language within Lisp itself. Furthermore, its very useful to express mathematical concepts. As Lisp has been modernized throughout the past few decades, many of its dialects also incorporate paradigms like OOP and FP, which give it additional & unique properties.
Conclusion
Lisp is useful, and it dates to before nearly any other high level programming language, excepting Fortran. Its strange and abstract concepts/features are intimidating, true, but once the language is understood, programming nearly anything in it is possible. Its metaprogramming (programming of the program [self-manipulating], meta means something like inwards on self, ex. metaphysics is the physics of physics) and rigid data structure manipulation are reasons why it is used for a number of applications, such as AI (artificial intelligence), which require higher level mathematics and an adapting environment. (scientific simulation comes to mind) For those who read more on Lisp and instantly don't like it, visit link 2 before you hate on it.
This concludes my first article. I realize some terms/concepts were somewhat obscure, my referencing vague, and a few other issues. However, since I am biased and can literally only see from my point of view, please feel free to rate and comment on this article as you see fit ; I only ask for reasonable and constructive criticism.
Cast your vote on this article 10 - Highest, 1 - Lowest
Comments: Published: 20 comments.
HackThisSite is the collective work of the HackThisSite staff, licensed under a CC BY-NC license.
We ask that you inform us upon sharing or distributing.