lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

The one line summary is that Titan is scripted in Lua while Terra is
metaprogrammed in Lua. In Titan, Lua acts as a scripting layer, calling
(and being called by) Titan at run time. Meanwhile, Terra uses Lua at
compilation time, as a powerful macro/template system.

Titan is specially designed to interface well with Lua at run-time. Its
type system is very similar to Lua's and it is garbage collected, just
like Lua. Lua values can directly be passed to Titan functions. The
motivation behind Titan is to make it easier to speed up Lua
applications code. Some simple Lua programs can be directly converted
to Titan by adding type annotations. In other cases, rewriting a Lua
module in Titan is much easier to do than rewriting it in C.

Terra, on the other hand, has a type system that is closer to C's than
to Lua's. At run-time, calling Terra from Lua is similar to calling C
from Lua. Terra uses a system similar to LuaJIT's FFI to automate the
conversion between Lua and Terra values, but obviously you cannot pass
a Lua table or function directly to Terra. You would need to use the
traditional Lua–C API for that. Since Terra has a much more "C-like"
semantics it is specially suited for high-performance computing. For
example, it has builtin support for SIMD operators and the
metaprogramming is very useful for implementing optimizations such as
loop tiling[1].