From: "wardrop (Tom Wardrop)" Date: 2013-02-27T20:19:35+09:00 Subject: [ruby-core:52993] [ruby-trunk - Bug #7975] Why __dir__, not __DIR__ Issue #7975 has been updated by wardrop (Tom Wardrop). =begin We did come to any sort of resolution to the naming inconsistency between __dir__/__method__ and __FILE__/__LINE__ in any of those mentioned issues. Should we not add __file__ and __line__ as methods, and perhaps deprecate the keywords __FILE__ and __LINE__. This would keep it consistant with all the other double-underscore methods. To most developers who perhaps do not know Ruby as intricately as most of the people on this issue tracker, the inconsistency between __dir__ and __FILE__ is not just confusing by name, but the fact that one is a method and one isn't, is doubly confusing. Definitely not principle of least surprise. This needs to be addressed in my opinion, either through deprecation of __FILE__ and __LINE__, or by keeping those keywords and simply creating Kernel method equivalents for the sack of a consistant API. While on the topic, someone also suggested in one of those previous issues, to give __dir__ an optional join argument, so you could do something like this: (({__dir__('somefile.txt') # => /Users/admin/somefile.txt})) I'd predict that at least 90% of use cases for __dir__ will involve joining it to another path or filename. I can't see any harm in adding this. The naming inconstancies are my main concern however. =end ---------------------------------------- Bug #7975: Why __dir__, not __DIR__ https://bugs.ruby-lang.org/issues/7975#change-37146 Author: yimutang (Joey Zhou) Status: Rejected Priority: Normal Assignee: Category: Target version: ruby -v: 2.0 There's a __FILE__ in Ruby 1.x, no __file__ Why __dir__ in Ruby 2.0 is downcase? It's not consistent. -- http://bugs.ruby-lang.org/