Open agis opened 12 years ago
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!
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 andsinatra/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).