3 ms·
They enforce invariants automatically for you that you might have to manually deal with in the host language. Examples: * You'd have to remember to free heap a
by akkartik 2y ago
They enforce invariants automatically for you that you might have to manually deal with in the host language. Examples:
* You'd have to remember to free heap allocations in C. Lua does it for you.
* You might want to always access a particular object's field through a function rather than directly. If you programmed in C it's your responsibility to not mess this up, you won't get any warnings or errors if you forget. A scripting language could automatically call the function when you try to access the field.
* You might want to ensure that any switch case over a enum always considers all possible values of the enum. C wouldn't help you here, but Fennel's infrastructure for pattern matching would.