Lingua: What simple ideas could improve programming languages?
You certainly don’t want yet another general-purpose programming language, do you? Neither do I, as many programming languages are available out there, ranging from full production languages to “experimental” ones.
My favorite language pick mostly depends on the platform I want to target for a given project: PHP is my preferred choice for Web development, while Objective-C 2.0 is what I use when I design iPhone or Mac software; C++ is the one I take when I want to recycle former code portions I created in the 80s and 90s, and Java for the code I produced in the past decade.
Sometimes, I want to escape from the day-to-day routine when I want to give other languages a try that I never get a chance to incorporate into production projects. For example, I recently enjoyed Python to test Google’s cloud system — aka App Engine, to cite one.
But frankly, I have no time to dive into all the languages that exist — such as Scala or others — and I probably never will; what a pity.
Anyway, from a productivity perspective, I would rather use one and only one language I like for all the purposes I’ve cited so far, and for my future needs — I mean the future platforms or devices I’ll surely want to program for.
You know how cool it would be if there existed one language — The Language — that you could program in once and port everywhere as the native language of those devices.
Though this is and remains a pure dream, I’ve taken a few days to think about what such a language could be and what required features it would have to expose.
The answer is Lingua, a new class of language — not only one that offers memory management, a VM, object-orientation, and the like, but also one that implements two simple ideas: dialect support and language-to-platform translation.
Notion of dialect: abolition of the Tower of Babel curse
You certainly know about the Tower of Babel story: at that time, all humans on Earth shared the same single language. Humanity had become so organized that they decided to challenge God’s supremacy by building the Tower of Babel so high that they could reach God Himself and become as great as Him. While God acknowledged that their efficiency was drawn from their organization, He decided to create as many different languages as the number of tribes so that they could no longer communicate with each other as they did before. This simply stopped the building.
Since then, we all speak different languages, and frankly that doesn’t help in building software either. The current situation in a team is that we choose the same language — say Objective-C — and develop with it regardless of the staff members’ native language. And they all write:
<pre>
if (c>10) {
// some code
}
else {
// some code
}
</pre>
If I were French — which I actually am — I would preferably type the equivalent code in French:
<pre>
si (c>10) {
// some code
}
sinon {
// some code
}
</pre>
This, simply put, is the fundamental idea of Lingua: it offers the capacity to be translated on the fly to match the programmer’s language.
When a French programmer types Lingua source code, he might prefer to use the French dialect, while a Chinese programmer, a staff member on the same team, might prefer to use the Chinese Lingua dialect.
When the French programmer loads a source file from an English programmer, his Lingua-aware text editor simply translates the language keywords and displays the source code in the right language.
(Franca) Lingua is an object-oriented language I have designed with the essential objective of matching human cultural differences, in that it can indifferently use any dialect.
Lingua simply “compiles” into your platform!
And you know what? You can implement a new platform yourself effortlessly.
How come? Programming languages are dialects as well! Yes, the dialect notion can simply be extended, and you can define a PHP dialect or an Objective-C dialect and ask Lingua to export into it! It’s that simple!
Lingua project status
Within a few days of thinking and programming, I managed to build the core syntax of Lingua — close to the C-family language syntax that almost everyone knows.
I wrote the syntax description and the related engine so that you can quickly implement any syntax feature you want.
As of now, you can switch the dialect across a range of languages including French, English, and Greek — it’s only a matter of translation.
And finally, I implemented two export dialects: PHP and Objective-C.
I wrote a couple of very small code examples and tested them in PHP and Objective-C, proving the idea to be useful, which is why I decided to share this idea with you in the hope that someone might take it and implement dialects in a production language — who knows.
Of course, beyond this proof of concept, the Lingua project would require much more energy to be put into it if I ever wanted to use it in real life.
Last but not least, dialects solve some important issues, but not all of them! What about the Chinese comments in my French source?