Programming Languages – Does This Kind of Language Exist?

language-designprogramming-languages

I'm thinking about creating my own pet programming language, and I have been wondering if similar language already exists.

The basic idea is that the language itself would be dynamically typed with strong metaprogramming capabilities (think Ruby). But instead of running it directly, it would be interpreted/expanded into another language, that would be statically typed, with static data structure and minimal dynamic dispatch (think C). This would then be compiled to machine code. The expansion could happen before running the program or during it's deployment, and all necessary libraries would be part of it, instead of each library being expanded separately.

Before I start working on it, I would like to know if anything like that already exists. So I can either inspire myself or drop it, because it would be useless work.

Best Answer

You may want to look at Julia.

It's a modern, dynamically typed language with Lisp inspired meta programming. It also JIT compiles using LLVM. The standard library is written in Julia too and is compiled and cached on first use I.e. A form of install time AOT compilation. As the LLVM IR is statically typed, I think this has most of the features you were looking for although, as with many dynamic languages, REPL usage was an important consideration hence the JIT compilation.

One interesting paper I saw (section 5.2). The standard library has around 135k variables of which about 80k had a fixed, static type. The rest had to stay represented as the variant type Any.

Depending on why you're interested in dynamic to static, this may be of value when you look at how dynamic you make your language. Obviously, this has some bearing on performance although, in practice, Julia seems quite quick.

Related Topic