Comment by lmm
10 years ago
> You can work around some of the debugging complexity by outputting each stage to a suitable format so you can test each transformation individually, but it's still hard to keep track of exactly what each stage expects and delivers.
Honestly this sounds like a good case for a type system - which of course isn't available in ruby.
Of course it's available in Ruby. You just don't get ahead-of-time verification without lots of extra trouble (implementing it yourself). The problem is not that you can't specify pre-conditions, and use the type system to do it.
The problem is that either you create specialized IR's for each stage, or a lot of this is expressed through tree shape, and it's just painful to mentally keep track of more than it is painful to test.
Try Crystal, then?