From: matz@... Date: 2019-06-13T05:57:02+00:00 Subject: [ruby-core:93088] [Ruby trunk Bug#15733] Inconsistent __FILE__ and Kernel#__dir__ Issue #15733 has been updated by matz (Yukihiro Matsumoto). Status changed from Open to Rejected `__FILE__` and `__LINE__` are inherited from C preprocessor. Others aren't. I am not going to pursue consistency here. Matz. ---------------------------------------- Bug #15733: Inconsistent __FILE__ and Kernel#__dir__ https://bugs.ruby-lang.org/issues/15733#change-78510 * Author: tagomoris (Satoshi TAGOMORI) * Status: Rejected * Priority: Normal * Assignee: * Target version: * ruby -v: * Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN ---------------------------------------- This might be duplicated with #7975, #8098 and #3346, but I believe it's worth to revisit. Now, Ruby has `__FILE__` keyword and `Kernel#__dir__` method. One is of upper-case chars, and the other is of lower-case chars. I make mistakes always when I want to get the directory name of the current file, to write `__DIR__` (of course, it doesn't exist). That is because of inconsistency between `__FILE__` and `__dir__`. I understood the reason why `__dir__` is of lower-case chars (to show it's defined as a method, not keyword), but this inconsistency brings huge confusion to me. So, in my opinion, Ruby should have one of these options below: * keyword `__DIR__` * method alias `Kernel#__DIR__` (as a compromise, but are there any difference between keyword `__DIR__` and `Kernel#__DIR__`?) * method `Kernel#__file__` (we don't take care of method overheads when we access file systems) -- https://bugs.ruby-lang.org/ Unsubscribe: