Lingua: what simple ideas could improve programming languages?

Sept. 10th, 2009 19:30 by Stéphane de LucaPermalink | TrackBack: https://stephanedeluca.com/trackback/869 — exists for 15 years & 2 months ago

You certainly don't want yet another general purpose programming language, do you? Neither I do as many programming language are available out there, ranging from full production language 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 softwares; 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 evade from the day-to-day routine, when want to I give a try and use others languages 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 exist -- such as Scala or others -- and I probably never have; what a pity.

Anyway, from my productivity perspective, I should have use one and only one language I'd like for all purposes I cited so far, and for my future needs, I mean my future platforms or devices I'd surely want to program for.
You know how cool it would be if it exists one language -- The Language -- that you can program 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 could be such a language and what should be the required feature it have to expose.

The answer is Lingua, a new class of language, not only the one which offers memory management, VM, object-orientation and the like, but also the one that implements two simple ideas: dialect support and language to platform translation.

Notion of dialect: abolition of the Babel Tower curse

You certainly know about the Babel Tower story: at that time, all humans on earth was sharing the same and unique language. Humanity was became so organized that they decided to threat God supremacy by building the Babel Tower so high that they could reach God himself and become as Big as Him. While God acknowledge that their efficiency was drawn from their organization, He decided to as many different languages as the number of tribes so that they could not longer communicate each others as they did before. This simply stopped the building.

Since then, we all speak a different language and frankly that don't help building software either. The current situation in a team is that we chose the same language -- say the Objective C -- and develop with it regardless the staff member's native language. And they all say:

if (c>10) {
	// some code
}
else {
	// some code
}

If I were french -- which I am actually -- I would preferably typed the equivalent code in french:

si (c>10) {
	// some code
}
sinon {
	// some code
}

This simply put, is the fundamental 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 preferably use the french dialect, while a chinese programmer, staff member of the same team, might prefer to use the chinese lingua dialect.

While the french programmer loads a source file from an english programmer, his text editor -- lingua aware -- simply translate the language keyword and displays the source code in the right language.

(Franca) Lingua is an object-oriented language I have designed with the essential objective to match human cultural differences in that it can indifferently use any dialect.

Lingua simply "compile" into your platform!

And you know what, you can yourself implement a new platform effortless.

How it comes? 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 manage to build the core syntax of Lingua -- being close of the C family languages syntax which almost everyone knows.

I wrote the syntax description and the related engine so that you can quickly implement any syntax feature you'd want.

As per now, you can switch the dialect from a range of language including: french, english and greek -- it's only a matter of translation.

And finally, I implemented two exportation dialects: PHP and Objective-C.

I wrote a couple of very small examples of code and tested it into PHP and Objective-C and proved the idea to be useful and this is why I decided to share this idea with you with the hope someone would 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 whenever I wanted to use it in the real life.

Last but not least, dialects solve some important issues but not all issues! What about the chinese comments in my french source?