Open samnang opened 12 years ago
Historical reasons, I guess. Rack is a pretty old library and this naming convention wasn't as strict back then (I am not even sure whether it wasn't just considered a "Rails convention"). Changing the file name of commonlogger.rb
would break a lot of stuff.
I noticed that Rack takes capitalized hash key like :Host
, :Port
, and :AccessLog
(https://github.com/codereading/rack/blob/rack-1.4/lib/rack/server.rb#L43).
Are these historical, too? They are queer to me.
I think the case here is a bit different:
https://github.com/codereading/rack/blob/rack-1.4/lib/rack/server.rb#L142-173
As you can see, most options are downcased, except the options that are directly passed to the Handler. I think its a kind of "namespacing".
I see. Thanks @skade !
Changing the file name of
commonlogger.rb
would break a lot of stuff.
Why that could be happen? I see it load by using autoload :CommonLogger, "rack/commonlogger"
in lib/rack.rb
, so other libraries could require 'rack'
and use this middleware by calling its classname use Rack::CommonLogger
without any problems. I don't see the point why other libraries require 'rack/commonlogger'
directly like that.
One reason might be that autoload
is inherently thread-unsave and should not be used. It is also deprecated and flagged for removal[1]. Also, even if autoload hooks are in place, libs are still free to require commonlogger.rb
by hand, which some do to ensure load order. I do so regularly to avoid autoload issues which blow up in my face in regular intervals and would recommend to do so in any case.
[1] http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/41149
Following Ruby standard filename convention, filename should be all in lowercase and separate each word by underscore, but I see some filenames break this rule:
I feel it should be
Do have any ideas why they have filenames like this?