3 ms·
Type systems and compilers are much more complex to implement than interpreters, so you need a bigger team to make them feasible. It's no accident that Python
by repolfx 7y ago
Type systems and compilers are much more complex to implement than interpreters, so you need a bigger team to make them feasible.
It's no accident that Python and Ruby were both the work of one guy in their early years: very, very simple to implement incrementally.
- imtringued 7y agoThis is changing because of LLVM. It is now very easy to implement AOT compilation for your programming language. However, implementing an efficient garbage collector in an AOT compiled program is still challenging compared to an interpreter where the stack and each object is just an array of object references. With raw memory you don't know whether something is a number or a reference unless you store extra information that describes the memory layout of every single function or object.
- repolfx 7y agoI'd say it's actually because of Graal. LLVM is helpful for writing a compiler but only changes the difficulty by say, one or two orders of magnitude. But the difficulty of making a fully statically typed compiled language is many orders of magnitude larger than one guy hacking together an interpreter. The nice thing about GraalVM and modern gradual typing techniques is you can actually start by writing an interpreter, fully dynamic, no type system at all. Graal turns the interpreter into JIT compiled code on the fly, you can even create a standalone (no JVM) AOT compiled binary containing your language runtime, all with one command. Then as your language evolves you can add interpreter hints to gain extra performance, but, it's totally pay-as-you-go. There are no walls of effort facing you: you do a little work to get a little benefit, and a lot more to get to V8 type speeds. You can also introduce a type system gradually these days, as CoffeeScript/TypeScript or Groovy style languages do, again incrementally as your language evolves and gains usage. Also with Graal you get the world's best GCs for free, plus access (if you want it) to the JDK class libraries for things like files/sockets/time&date handling. Oh, and language interop with other languages for free, no complex FFIs. It's pretty neat. That said, are there lots of programmers itching to write dynamically typed scripting languages these days? Probably not. Languages like Kotlin deliver most of the benefits with very few of the downsides.