top | item 41101396

(no title)

hugomg | 1 year ago

tl;dr: For Pallene, Lua is a scripting language. For Terra, Lua is mainly for metaprogramming.

The key difference is that Terra cannot directly manipulate Lua data. Although Terra's syntax is similar to Lua, its type systems and data structures are actually much closer to C. If we want to pass Lua table into Terra, we must first convert it into Terra arrays/structs. This cost adds up if the code uses many Lua data structures; in the worst case it can be worse than just using Lua for everything.

Passing data between Lua and Pallene should incur no cost. If the programmer rewrites a piece of code from Lua to Pallene, it should hopefully make things faster, and never slow it down.

Terra is more focused on metaprogramming. Generating code and executing things at compile-time. Think of C++ templates, but better.

discuss

order

samatman|1 year ago

Great answer, thanks! I see the appeal.