I hate how module scripts are horrible for performance and hard to manage, but there were no other solutions to organize the game, really.
My solution: duct taping everything and making a plugin to sync up code fields, heavily inspired by header files from C/C++
I will make this plugin free and open soon; it’s almost completed.
#include <stdio.h>
#define WOW int
#define SUCH main
#define GOOD (
#define SCRIPTING )
#define MUCH {
#define GREAT printf
#define OK ("1337")
#define THANKS ;
#define BYE return 0; }
WOW SUCH GOOD SCRIPTING MUCH GREAT OK THANKS BYE
It looks cool, but I do have a few questions, especially in the nature of how this is implemented, mostly because it is labelled #include.
Does this literally just copy and paste the include contents into the file that included it?
Does this avoid redefinition issues? for example, if you had two “headers” that both defined functions under the same signature, would it error out for duplicate definitions or just use the one from the latest header you included? It could cause a fair amount of issues and subtle bugs if not.
(similar to 2) Do you plan to add support for include rules like #pragma once or legacy include guards?
The main upside to modules is providing quick and easy access to shared data between scripts. Does this have a kind of alternative (or a wrapper with modules) or is this omitted entirely?
This would definitely pollute the global scope; do you plan to add some kind of namespacing system?
Can you declare things private to the “header” file, similar to the static keyword?
Why this over require with a module?
Is this part of a larger preprocessor?
My main concern is the fact that #include is designed for a compiled language with translation units, and, well, Luau isn’t compiled (the same way that C/C++ is), and it (obviously, given the previous statement) doesn’t have translation units.
It’s either satire or Yarik is going to implement a C interpreter. Not transpiler, interpreter. Clearly, he is going to rewrite the script editor and add an LSP for C.
Luauception. In his C in Luau there will be a Luau implementation, implemented in C in Luau. Then in that Luau he will implement C again. And then in that C he will implement Luau. This pattern repeats until he dies of old age.
A well known issue with include is that it copies each header file multiple times, while I know things like pragma once are designed to fix this issue in C++, how has this been handled here?