Tuesday 27 February 2018

What is Egg?

“Egg” is an idea I’ve been thinking about for a long time. Here’s the background…

At work, over the last few months, I’ve used many computer languages:

  1. C++
  2. C#
  3. Java
  4. JavaScript
  5. Clojure
  6. Python
  7. PowerShell
  8. Windows batch commands
  9. Bash

and almost as many build/configuration file formats:

  1. Makefile
  2. JSON
  3. XML
  4. YAML
  5. INI

I appreciate that domain specific languages have their place, but often runtime performance is not an issue, so using a general-purpose language would be more than adequate. Constantly having to context-switch between difference languages and paradigms is exhausting; not to mention the numerous bugs caused by forgetting the specifics of each set of syntaxes, escape sequences, library routine quirks and so on.

What if there was a simple language that was powerful enough to get the job done without having to remember too many subtleties of the language?

Another issue I have with many languages is the lack of simple interoperability. If I want to call a C++ routine from Clojure, I’m going to have to jump through hoops.

Similarly, if you develop a prototype in one language, you often have to “productionize” it by converting it to another. This is a great source of bugs.

What if there was a language that you could transpile into other languages?

Even if the transpiled code was purely used to get a unit test framework up and running before refactoring, this would greatly mitigate the introduction of bugs.

Some of these interoperability issues are due to the frameworks or virtual machines that some of the languages require:

  • Java Virtual Machine
  • .NET Framework
  • and so on

In this regard, I think that JavaScript is quite successful because of its ubiquity: press F12 inside your browser and you have quite a powerful development environment. Running scripts outside of a browser simply requires you to download a zero-install executable such as Node.js.

What if there was a language that ran almost identically on many frameworks and/or virtual machines?

Anecdotally, it seems that Python is gaining ground as a teaching language. I’m not going to knock Python, but it seems strange that there appear to be few other candidates for teaching good software engineering practices.

What if there was a language that could be used for teaching the fundamentals of programming whilst still being useful outside of academic institutions?

Talking of Python, why do computer languages develop to the point where the designers make breaking changes (e.g. Python 2 versus Python 3)? Even venerable C++ is getting a new set of features every three years that’s difficult to keep up with.

What if there was a language that had a relatively stable syntax?

But “egg” isn’t just a computer language specification, it’s:

  • An engine to run scripts written in egg
  • A compiler to generate native code from egg source
  • A set of transpilers to generate other computer languages from egg source
  • A build system (written in egg, of course)
  • A set of core packages to perform common tasks
  • A testing framework
  • A package manager

So, that’s what “egg” is: a personal project to give me an excuse to investigate these issues.

1 comment :