Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

require modules instead of namespace #3

Closed
pablomayobre opened this issue Nov 26, 2017 · 1 comment
Closed

require modules instead of namespace #3

pablomayobre opened this issue Nov 26, 2017 · 1 comment

Comments

@pablomayobre
Copy link
Contributor

As discussed in Discord:

Namespaces make weak relationships between modules. This means that for dialogue.lua to work init.lua needs to correctly place node.lua in Namespace.node which is a possible point of failure.

You may later revisit node.lua and or init.lua and then dialogue.lua would stop working because it can't find what it's searching for in Namespace.node

Directly requiring node.lua in dialogue.lua would fix this issue, since you can clearly see what file depends on what other file.

Namespaces are generally useful when you need to require tens of files in a single file, or when you have recursive dependencies. But neither is the case, Babble is pretty module and all the files require 1 other file or none at all.

@Keyslam Keyslam closed this as completed Nov 27, 2017
@Keyslam
Copy link
Owner

Keyslam commented Nov 27, 2017

Namespace has been removed. Files now have to explicitly require their dependencies. Init.lua now contains a table that is filled and returned with all modules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants