28 Dec 23

When you write a module in C’Dent, you can use it in a dozen different programming languages. For instance, you could write a module in Python and use it in JavaScript, or you could write a module in JavaScript and use it in Perl 6, Ruby or Java.

What a trip.

This is of limited use since it’s for logic, not for API stuff, and most apps write their own logic instead of relying on modules for logic, but I’ll have to try to remember that this exists for things that do rely on logic.

One example that does come to mind is an infix expression parser library that takes strings as input and returns numbers. Something like that could work with C’Dent.

Under “next steps” it says:

Add variables and assignments

Conclusion: completely useless for now without further hacking & patching.

by 2097 2 years ago

30 Aug 23

A library in Fennel obeys the exact same rules as a Lua library, except the Fennel compiler adds some steps to the whole process of library loading.

by eli 2 years ago

07 Aug 23

Before you understand how reloading works in Fennel, you need a little background regarding Lua’s module system, since Fennel is just a compiler that emits Lua code. Older versions of Lua had a module function which would declare the whole rest of the file as being part of a specific module and register that with the module system, and all functions that would normally be declared as global within that file would be exported as part of the module instead. But in version 5.1, that system was recognized as redundant: nowadays a module is just a file that returns a table1 with closures and other values in it. This is reflects the relentless simplicity behind the design of Lua; why have modules as their own concept when tables and closures can do just as good a job?

by eli 2 years ago