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

Why do sinatra/main requires sinatra/base? #12

Open
agis opened this issue Jun 13, 2012 · 1 comment
Open

Why do sinatra/main requires sinatra/base? #12

agis opened this issue Jun 13, 2012 · 1 comment

Comments

@agis
Copy link

agis commented Jun 13, 2012

I know that a Sinatra app can be built using the Classic or the Modular style, meaning that it will require sinatra for the former and sinatra/base for the latter.

But I was wondering, why does sinatra/main.rb requires sinatra/base?

This is certainly not needed when you're using the Classic or the Modular way, cause in each case this file is loaded either via sinatra.rb (classic) or directly (modular).

@gwynforthewyn
Copy link

I imagined that this was the case because a module is meant to take care of its own dependencies. In the case of Sinatra/main, that dependency is Sinatra/base. In the case of Sinatra.rb, those dependencies are both base and main.

There's no harm in having a double require: require's smart enough to recognise that a file has already been required and won't re-require.

That was my assumption, anyway!

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