You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Not a bug as such, but I came accross some difficulties while testing some functions. Rather than allowing me to pass the state through a pointer, almost all functions rely on global objects. For example, startFunctionParameters() and startFunction() both rely on globals. In startFunction() I got until function_mode->context = malloc(1 + strlen(module_path_stack.arr[module_path_stack.size - parent_context]));. The module_path object (which is also global) requires some complex construction and after commenting out those lines, I reached if (module == NULL && strcmp(function_cursor->module, "") != 0) { (line 221 I think) after that I gave up.
I think improved documentation and a more clear api could help, but having global state spread accross multiple files makes it more difficult to modify or add new functionality to the code.
Perhaps an approach would be to add all globals to a struct Globals {} object which could then be passes to every functtion: void startFunction(struct Globals *state, char *name, enum Type type)
This is, of course, only one possibility.
The text was updated successfully, but these errors were encountered:
Not a bug as such, but I came accross some difficulties while testing some functions. Rather than allowing me to pass the state through a pointer, almost all functions rely on global objects. For example, startFunctionParameters() and startFunction() both rely on globals. In startFunction() I got until
function_mode->context = malloc(1 + strlen(module_path_stack.arr[module_path_stack.size - parent_context]));
. The module_path object (which is also global) requires some complex construction and after commenting out those lines, I reachedif (module == NULL && strcmp(function_cursor->module, "") != 0) {
(line 221 I think) after that I gave up.I think improved documentation and a more clear api could help, but having global state spread accross multiple files makes it more difficult to modify or add new functionality to the code.
Perhaps an approach would be to add all globals to a
struct Globals {}
object which could then be passes to every functtion:void startFunction(struct Globals *state, char *name, enum Type type)
This is, of course, only one possibility.
The text was updated successfully, but these errors were encountered: