Rust: The New LLVM
Counterpoints as someone considering writing a language that targets LLVM, and as someone who has used Rust a bunch:<p>- Your compile times will be a lot slower than they would otherwise be. This is a big one for me.<p>- If your type system is materially different than Rust's, you don't gain any benefits since you have to write your own type checker anyways.<p>- LLVM is designed to be easy to machine generate, including having a library API for generating code. Rust doesn't yet.<p>- You can't necessarily re-use Cargo if your language requires type info to link that wouldn't be in the Rust source files generated.<p>- If you have semantic differences in memory model you'll need to give up the advantage of Rust's safety by having your code generate unsafe pointers, for example if you want to have shared mutability in a single-threaded context, which Rust doesn't handle nicely.<p>- If you do re-use Rust's type checker the error messages you get out will be terrible and point into generated Rust code.<p>- Debug info and debugging get even harder.<p>- If you want Rust interoperability you have to replicate Rust's enormous type system in your language's FFI, which is hard if you also have your own type checker, see above.<p>Basically it is a good idea, if your language has semantics and type system very close to Rust.<p>A much better idea IMO is to target LLVM and then write an LLVM plugin that can link to Golang object files and generate Golang struct metadata. Golang's FFI and type system are much much simpler and more likely to be able to graft onto new languages. Also Go's library ecosystem is larger.