teal-language / tl

The compiler for Teal, a typed dialect of Lua
MIT License
2.1k stars 108 forks source link

Split up code into multiple files #549

Open makspll opened 2 years ago

makspll commented 2 years ago

As it stands it's difficult to parse through and contribute to this project,

splitting the main file into multiple would make this easier.

Is this something that's possible without breaking the public interface ?

lenscas commented 2 years ago

There are programs that bundle multiple lua files into 1 file (see https://github.com/teal-language/tl/issues/67 for some mentions).

So, in theory it should be possible to keep the API exactly the same and even keep distributing the lua version of the teal compiler as a single file.

However, it would take careful consideration on how to split the project up, especially as require() can be used to load the separate .tl files directly. Meaning that other projects can end up relying on API's that are meant to be internal only. (At least, to my knowledge there is no way in lua to prevent this?)